Skip to content

Commit

Permalink
fs/pipe.c: add ->statfs callback for pipefs
Browse files Browse the repository at this point in the history
Currently a statfs on a pipe's /proc/<pid>/fd/ link returns -ENOSYS.  Wire
pipfs up so that the statfs succeeds.

This is required by checkpoint-restart in the userspace to make it
possible to distinguish pipes from fifos.

When we dump information about task's open files we use the /proc/pid/fd
directoy's symlinks and the fact that opening any of them gives us exactly
the same dentry->inode pair as the original process has.  Now if a task
we're dumping has opened pipe and fifo we need to detect this and act
accordingly.  Knowing that an fd with type S_ISFIFO resides on a pipefs is
the most precise way.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Reviewed-by: Tejun Heo <tj@kernel.org>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Pavel Emelyanov authored and Linus Torvalds committed Nov 1, 2011
1 parent a8aff21 commit d70ef97
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1254,6 +1254,7 @@ long pipe_fcntl(struct file *file, unsigned int cmd, unsigned long arg)

static const struct super_operations pipefs_ops = {
.destroy_inode = free_inode_nonrcu,
.statfs = simple_statfs,
};

/*
Expand Down

0 comments on commit d70ef97

Please sign in to comment.