diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1997-12-16 05:34:03 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1997-12-16 05:34:03 +0000 |
commit | 967c65a99059fd459b956c1588ce0ba227912c4e (patch) | |
tree | 8224d013ff5d255420713d05610c7efebd204d2a /fs/autofs | |
parent | e20c1cc1656a66a2773bca4591a895cbc12696ff (diff) |
Merge with Linux 2.1.72, part 1.
Diffstat (limited to 'fs/autofs')
-rw-r--r-- | fs/autofs/waitq.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/fs/autofs/waitq.c b/fs/autofs/waitq.c index 7e4558d9d..607b4314e 100644 --- a/fs/autofs/waitq.c +++ b/fs/autofs/waitq.c @@ -42,31 +42,36 @@ void autofs_catatonic_mode(struct autofs_sb_info *sbi) static int autofs_write(struct file *file, const void *addr, int bytes) { - unsigned long fs; - unsigned long old_signal; + unsigned long sigpipe, flags; + mm_segment_t fs; const char *data = (const char *)addr; - int written = 0; + ssize_t wr = 0; /** WARNING: this is not safe for writing more than PIPE_BUF bytes! **/ + sigpipe = sigismember(¤t->signal, SIGPIPE); + /* Save pointer to user space and point back to kernel space */ fs = get_fs(); set_fs(KERNEL_DS); - old_signal = current->signal; - - while ( bytes && (written = file->f_op->write(file,data,bytes,&file->f_pos)) > 0 ) { - data += written; - bytes -= written; + while (bytes && + (wr = file->f_op->write(file,data,bytes,&file->f_pos)) > 0) { + data += wr; + bytes -= wr; } - if ( written == -EPIPE && !(old_signal & (1 << (SIGPIPE-1))) ) { - /* Keep the currently executing process from receiving a - SIGPIPE unless it was already supposed to get one */ - current->signal &= ~(1 << (SIGPIPE-1)); - } set_fs(fs); + /* Keep the currently executing process from receiving a + SIGPIPE unless it was already supposed to get one */ + if (wr == -EPIPE && !sigpipe) { + spin_lock_irqsave(¤t->sigmask_lock, flags); + sigdelset(¤t->signal, SIGPIPE); + recalc_sigpending(current); + spin_unlock_irqrestore(¤t->sigmask_lock, flags); + } + return (bytes > 0); } |