diff mbox

[1/9] task_struct: add PF_NONOTIFY for fanotify to use

Message ID 20090828185542.8014.22791.stgit@paris.rdu.redhat.com
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

Eric Paris Aug. 28, 2009, 6:55 p.m. UTC
Since fanotify opens file descriptors inside the kernel for it's listeners
it needs a way to make sure that 2 fanotify listeners, both which listen to
open events do not continuously see each others open events (and get into a
livelock reporting on each other's activity).  This fix is to create a new
tast_struct flags called PF_NONOTIFY.  If this flag is set in a task no
fanotify events will be generated for that task.   fanotify will set the
flag before and open call and will clear it immediately after.

Signed-off-by: Eric Paris <eparis@redhat.com>
---

 include/linux/sched.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Evgeniy Polyakov Aug. 28, 2009, 10:36 p.m. UTC | #1
Hi.

On Fri, Aug 28, 2009 at 02:55:42PM -0400, Eric Paris (eparis@redhat.com) wrote:
> Since fanotify opens file descriptors inside the kernel for it's listeners
> it needs a way to make sure that 2 fanotify listeners, both which listen to
> open events do not continuously see each others open events (and get into a
> livelock reporting on each other's activity).  This fix is to create a new
> tast_struct flags called PF_NONOTIFY.  If this flag is set in a task no
> fanotify events will be generated for that task.   fanotify will set the
> flag before and open call and will clear it immediately after.

Is there a way to get old-school notifications with the object
information instead of opened file desriptor, which may suffer rlimit
problems and scalability issues with too many opened/closed descriptors?
Eric Paris Aug. 28, 2009, 10:39 p.m. UTC | #2
On Sat, 2009-08-29 at 02:36 +0400, Evgeniy Polyakov wrote:
> Hi.
> 
> On Fri, Aug 28, 2009 at 02:55:42PM -0400, Eric Paris (eparis@redhat.com) wrote:
> > Since fanotify opens file descriptors inside the kernel for it's listeners
> > it needs a way to make sure that 2 fanotify listeners, both which listen to
> > open events do not continuously see each others open events (and get into a
> > livelock reporting on each other's activity).  This fix is to create a new
> > tast_struct flags called PF_NONOTIFY.  If this flag is set in a task no
> > fanotify events will be generated for that task.   fanotify will set the
> > flag before and open call and will clear it immediately after.
> 
> Is there a way to get old-school notifications with the object
> information instead of opened file desriptor, which may suffer rlimit
> problems and scalability issues with too many opened/closed descriptors?

Use inotify.

-Eric

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Evgeniy Polyakov Aug. 28, 2009, 10:50 p.m. UTC | #3
On Fri, Aug 28, 2009 at 06:39:28PM -0400, Eric Paris (eparis@redhat.com) wrote:
> > Is there a way to get old-school notifications with the object
> > information instead of opened file desriptor, which may suffer rlimit
> > problems and scalability issues with too many opened/closed descriptors?
> 
> Use inotify.

I need pids.
Eric Paris Sept. 3, 2009, 8:25 p.m. UTC | #4
> On Fri, Aug 28, 2009 at 02:55:42PM -0400, Eric Paris (eparis@redhat.com) wrote:
> > Since fanotify opens file descriptors inside the kernel for it's listeners
> > it needs a way to make sure that 2 fanotify listeners, both which listen to
> > open events do not continuously see each others open events (and get into a
> > livelock reporting on each other's activity).  This fix is to create a new
> > tast_struct flags called PF_NONOTIFY.  If this flag is set in a task no
> > fanotify events will be generated for that task.   fanotify will set the
> > flag before and open call and will clear it immediately after.

So this patch isn't actually needed, I thought the fsnotify_open() call
was deeper than it is.  I'm going to drop this particular patch.

Can I take silence on the list as a lack of disagreement?  I'd like to
start putting these into linux-next starting tomorrow.  Obviously I'd
like to see the networking definitions approved and taken by davem, I'd
like to see the FMODE_ change approved and taken by viro, but if you two
would like me to push it directly I'd be happy to.

Davem, maybe you'd rather my af_fanotify was somewhere inside net/
instead of in fs/notify/fanotify?  I'd love to get some review here, but
noone onlist is excited enough to step up.  (I have numerous people who
have privately claimed they intend to use this stuff, so i promise it
won't be dead code.)

I'm ready to start committing and adding features, anyone telling me no?

-Eric



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/linux/sched.h b/include/linux/sched.h
index b88872f..3c1ce66 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1695,6 +1695,7 @@  extern cputime_t task_gtime(struct task_struct *p);
 #define PF_EXITING	0x00000004	/* getting shut down */
 #define PF_EXITPIDONE	0x00000008	/* pi exit done on shut down */
 #define PF_VCPU		0x00000010	/* I'm a virtual CPU */
+#define PF_NONOTIFY	0x00000020	/* In fanotify open operation */
 #define PF_FORKNOEXEC	0x00000040	/* forked but didn't exec */
 #define PF_MCE_PROCESS  0x00000080      /* process policy on mce errors */
 #define PF_SUPERPRIV	0x00000100	/* used super-user privileges */