linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH resend] vfs: Add ->statfs callback for pipefs
@ 2011-08-24  8:09 Cyrill Gorcunov
  2011-08-24  8:23 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Cyrill Gorcunov @ 2011-08-24  8:09 UTC (permalink / raw)
  To: Andrew Morton, Al Viro
  Cc: James Bottomley, Tejun Heo, Glauber Costa, containers,
	linux-kernel, Pavel Emelyanov, Serge Hallyn, Nathan Lynch,
	Oren Laadan, Daniel Lezcano, LINUXFS-ML

From: Pavel Emelyanov <xemul@parallels.com>

This is done to make it possible to distinguish pipes
from fifos when opening one via /proc/<pid>/fd/ link.

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>
---
 fs/pipe.c |    1 +
 1 file changed, 1 insertion(+)

Any objections to this one? It was a part of a patchset
but can be treated independently so I'm re-sending it alone.

Index: linux-2.6.git/fs/pipe.c
===================================================================
--- linux-2.6.git.orig/fs/pipe.c
+++ linux-2.6.git/fs/pipe.c
@@ -1254,6 +1254,7 @@ out:
 
 static const struct super_operations pipefs_ops = {
 	.destroy_inode = free_inode_nonrcu,
+	.statfs = simple_statfs,
 };
 
 /*

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH resend] vfs: Add ->statfs callback for pipefs
  2011-08-24  8:09 [PATCH resend] vfs: Add ->statfs callback for pipefs Cyrill Gorcunov
@ 2011-08-24  8:23 ` Andrew Morton
  2011-08-24  8:30   ` Cyrill Gorcunov
       [not found]   ` <20110824012328.f7bfc68a.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
  0 siblings, 2 replies; 4+ messages in thread
From: Andrew Morton @ 2011-08-24  8:23 UTC (permalink / raw)
  To: Cyrill Gorcunov
  Cc: Al Viro, James Bottomley, Tejun Heo, Glauber Costa, containers,
	linux-kernel, Pavel Emelyanov, Serge Hallyn, Nathan Lynch,
	Oren Laadan, Daniel Lezcano, LINUXFS-ML

On Wed, 24 Aug 2011 12:09:24 +0400 Cyrill Gorcunov <gorcunov@gmail.com> wrote:

> From: Pavel Emelyanov <xemul@parallels.com>
> 
> This is done to make it possible to distinguish pipes
> from fifos when opening one via /proc/<pid>/fd/ link.
> 
> 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>
> ---
>  fs/pipe.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> Any objections to this one? It was a part of a patchset
> but can be treated independently so I'm re-sending it alone.
> 
> Index: linux-2.6.git/fs/pipe.c
> ===================================================================
> --- linux-2.6.git.orig/fs/pipe.c
> +++ linux-2.6.git/fs/pipe.c
> @@ -1254,6 +1254,7 @@ out:
>  
>  static const struct super_operations pipefs_ops = {
>  	.destroy_inode = free_inode_nonrcu,
> +	.statfs = simple_statfs,
>  };
>  
>  /*

OK, I give up - how does it work?

<goes off and reads the kernel>

So it appears that the statfs call would previously return -ENOSYS, but
with this change the statfs will succeed and userspace can then inspect
f_type.  Yes?  I will fix your changelog by adding a description along these
lines.

And I'll ask you to fix it further by telling us why we want to do
this?  The kernel has had this issue for a long time - why does it now
matter?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH resend] vfs: Add ->statfs callback for pipefs
  2011-08-24  8:23 ` Andrew Morton
@ 2011-08-24  8:30   ` Cyrill Gorcunov
       [not found]   ` <20110824012328.f7bfc68a.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Cyrill Gorcunov @ 2011-08-24  8:30 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Al Viro, James Bottomley, Tejun Heo, Glauber Costa, containers,
	linux-kernel, Pavel Emelyanov, Serge Hallyn, Nathan Lynch,
	Oren Laadan, Daniel Lezcano, LINUXFS-ML

On Wed, Aug 24, 2011 at 01:23:28AM -0700, Andrew Morton wrote:
> On Wed, 24 Aug 2011 12:09:24 +0400 Cyrill Gorcunov <gorcunov@gmail.com> wrote:
> 
> > From: Pavel Emelyanov <xemul@parallels.com>
> > 
> > This is done to make it possible to distinguish pipes
> > from fifos when opening one via /proc/<pid>/fd/ link.
> > 
> > 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>
> > ---
> >  fs/pipe.c |    1 +
> >  1 file changed, 1 insertion(+)
> > 
> > Any objections to this one? It was a part of a patchset
> > but can be treated independently so I'm re-sending it alone.
> > 
> > Index: linux-2.6.git/fs/pipe.c
> > ===================================================================
> > --- linux-2.6.git.orig/fs/pipe.c
> > +++ linux-2.6.git/fs/pipe.c
> > @@ -1254,6 +1254,7 @@ out:
> >  
> >  static const struct super_operations pipefs_ops = {
> >  	.destroy_inode = free_inode_nonrcu,
> > +	.statfs = simple_statfs,
> >  };
> >  
> >  /*
> 
> OK, I give up - how does it work?
> 
> <goes off and reads the kernel>
> 
> So it appears that the statfs call would previously return -ENOSYS, but
> with this change the statfs will succeed and userspace can then inspect
> f_type.  Yes?  I will fix your changelog by adding a description along these
> lines.

Yes, it allows to distinguish pipes from anything else. Initially this patch was
a part of early rfc on checkpoint/restore facility (mostly implemented in
userspace). So we need to distinguish somehow pipes when we dump data from
/proc/pid/fd. That's the main reason. BUT since this patch can be used without
any other c/r bits and can be treated separately I've sent it alone without
any mention of c/r at all.

> 
> And I'll ask you to fix it further by telling us why we want to do
> this?  The kernel has had this issue for a long time - why does it now
> matter?

	Cyrill

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH resend] vfs: Add ->statfs callback for pipefs
       [not found]   ` <20110824012328.f7bfc68a.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
@ 2011-08-24  8:33     ` Pavel Emelyanov
  0 siblings, 0 replies; 4+ messages in thread
From: Pavel Emelyanov @ 2011-08-24  8:33 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	James Bottomley, Cyrill Gorcunov,
	containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org, Nathan Lynch,
	Al Viro, Tejun Heo, LINUXFS-ML, Daniel Lezcano

> 
> OK, I give up - how does it work?
> 
> <goes off and reads the kernel>
> 
> So it appears that the statfs call would previously return -ENOSYS, but
> with this change the statfs will succeed and userspace can then inspect
> f_type.  Yes?  I will fix your changelog by adding a description along these
> lines.

Yes, the primary intention is to get the f_type.

> And I'll ask you to fix it further by telling us why we want to do
> this?  The kernel has had this issue for a long time - why does it now
> matter?

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

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.

Thanks,
Pavel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-08-24  8:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-24  8:09 [PATCH resend] vfs: Add ->statfs callback for pipefs Cyrill Gorcunov
2011-08-24  8:23 ` Andrew Morton
2011-08-24  8:30   ` Cyrill Gorcunov
     [not found]   ` <20110824012328.f7bfc68a.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2011-08-24  8:33     ` Pavel Emelyanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).