Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 283223
b: refs/heads/master
c: d668dc5
h: refs/heads/master
i:
  283221: 68b3392
  283219: 3976546
  283215: 392abce
v: v3
  • Loading branch information
Al Viro committed Jan 11, 2012
1 parent 54cc74f commit 2ad227f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8753333266be67ff3a984ac1f6566d31c260bee4
refs/heads/master: d668dc56631da067540b2494d2a1f29ff7b5f15a
1 change: 1 addition & 0 deletions trunk/fs/autofs4/autofs_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ struct autofs_sb_info {
int needs_reghost;
struct super_block *sb;
struct mutex wq_mutex;
struct mutex pipe_mutex;
spinlock_t fs_lock;
struct autofs_wait_queue *queues; /* Wait queue pointer */
spinlock_t lookup_lock;
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/autofs4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
sbi->min_proto = 0;
sbi->max_proto = 0;
mutex_init(&sbi->wq_mutex);
mutex_init(&sbi->pipe_mutex);
spin_lock_init(&sbi->fs_lock);
sbi->queues = NULL;
spin_lock_init(&sbi->lookup_lock);
Expand Down
9 changes: 5 additions & 4 deletions trunk/fs/autofs4/waitq.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,27 @@ void autofs4_catatonic_mode(struct autofs_sb_info *sbi)
mutex_unlock(&sbi->wq_mutex);
}

static int autofs4_write(struct file *file, const void *addr, int bytes)
static int autofs4_write(struct autofs_sb_info *sbi,
struct file *file, const void *addr, int bytes)
{
unsigned long sigpipe, flags;
mm_segment_t fs;
const char *data = (const char *)addr;
ssize_t wr = 0;

/** WARNING: this is not safe for writing more than PIPE_BUF bytes! **/

sigpipe = sigismember(&current->pending.signal, SIGPIPE);

/* Save pointer to user space and point back to kernel space */
fs = get_fs();
set_fs(KERNEL_DS);

mutex_lock(&sbi->pipe_mutex);
while (bytes &&
(wr = file->f_op->write(file,data,bytes,&file->f_pos)) > 0) {
data += wr;
bytes -= wr;
}
mutex_lock(&sbi->pipe_mutex);

set_fs(fs);

Expand Down Expand Up @@ -179,7 +180,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi,

mutex_unlock(&sbi->wq_mutex);

if (autofs4_write(pipe, &pkt, pktsz))
if (autofs4_write(sbi, pipe, &pkt, pktsz))
autofs4_catatonic_mode(sbi);
fput(pipe);
}
Expand Down

0 comments on commit 2ad227f

Please sign in to comment.