Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 299842
b: refs/heads/master
c: 64f371b
h: refs/heads/master
v: v3
  • Loading branch information
Linus Torvalds committed Apr 29, 2012
1 parent 790829e commit b20c08b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 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: 9883035ae7edef3ec62ad215611cb8e17d6a1a5d
refs/heads/master: 64f371bc3107e69efce563a3d0f0e6880de0d537
11 changes: 11 additions & 0 deletions trunk/fs/autofs4/autofs_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,17 @@ int autofs4_fill_super(struct super_block *, void *, int);
struct autofs_info *autofs4_new_ino(struct autofs_sb_info *);
void autofs4_clean_ino(struct autofs_info *);

static inline int autofs_prepare_pipe(struct file *pipe)
{
if (!pipe->f_op || !pipe->f_op->write)
return -EINVAL;
if (!S_ISFIFO(pipe->f_dentry->d_inode->i_mode))
return -EINVAL;
/* We want a packet pipe */
pipe->f_flags |= O_DIRECT;
return 0;
}

/* Queue management functions */

int autofs4_wait(struct autofs_sb_info *,struct dentry *, enum autofs_notify);
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/autofs4/dev-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ static int autofs_dev_ioctl_setpipefd(struct file *fp,
err = -EBADF;
goto out;
}
if (!pipe->f_op || !pipe->f_op->write) {
if (autofs_prepare_pipe(pipe) < 0) {
err = -EPIPE;
fput(pipe);
goto out;
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/autofs4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
printk("autofs: could not open pipe file descriptor\n");
goto fail_dput;
}
if (!pipe->f_op || !pipe->f_op->write)
if (autofs_prepare_pipe(pipe) < 0)
goto fail_fput;
sbi->pipe = pipe;
sbi->pipefd = pipefd;
Expand Down

0 comments on commit b20c08b

Please sign in to comment.