linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <josef@redhat.com>
To: boyd yang <boyd.yang@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, eparis@redhat.com
Subject: Re: [PATCH] fanotify: to differ file access event from different threads
Date: Thu, 13 Oct 2011 09:38:15 -0400	[thread overview]
Message-ID: <20111013133815.GC2310@localhost.localdomain> (raw)
In-Reply-To: <CAE8kqZKQrDK4SAKc8vK7Wi46dGQBw6_LX2NFvkr-XZr_KmGhrQ@mail.gmail.com>

On Thu, Oct 13, 2011 at 04:56:43PM +0800, boyd yang wrote:
> This patch fixes a hang problem of Eric Paris's fs Notification/fanotify.
> 
> Fanotify brings a way to intercept file access events.
> When multiple threadsiterate the same direcotry, some thread will hang.
> This patch let fanotify to differ access events from different
> threads, prevent fanotify from merging access events from different
> threads.
> 

You need to run this through checkpatch.pl, you have a ton of formatting
problems.  Also your email client seems to have word-wrapped parts of this, so
use a email client that doesn't word wrap.

> =============================================================
> 
> diff -r -u linux-3.1-rc4_orig/fs/notify/fanotify/fanotify.c
> linux-3.1-rc4/fs/notify/fanotify/fanotify.c
> --- linux-3.1-rc4_orig/fs/notify/fanotify/fanotify.c	2011-08-29
> 12:16:01.000000000 +0800
> +++ linux-3.1-rc4/fs/notify/fanotify/fanotify.c	2011-10-10
> 12:28:23.276847000 +0800
> @@ -15,7 +15,8 @@
> 
>  	if (old->to_tell == new->to_tell &&
>  	    old->data_type == new->data_type &&
> -	    old->tgid == new->tgid) {
> +	    old->tgid == new->tgid &&
> +	    old->pid == new->pid) {
>  		switch (old->data_type) {
>  		case (FSNOTIFY_EVENT_PATH):
>  			if ((old->path.mnt == new->path.mnt) &&
> @@ -144,11 +145,19 @@
>  		return PTR_ERR(notify_event);
> 
>  #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS
> -	if (event->mask & FAN_ALL_PERM_EVENTS) {
> -		/* if we merged we need to wait on the new event */
> -		if (notify_event)
> -			event = notify_event;
> -		ret = fanotify_get_response_from_access(group, event);
> +	//if overflow, do not wait for response
> +	if(fsnotify_isoverflow(event))
> +	{
> +		pr_debug("fanotify overflow!\n");
> +	}
> +	else
> +	{
> +		if (event->mask & FAN_ALL_PERM_EVENTS) {
> +			/* if we merged we need to wait on the new event */
> +			if (notify_event)
> +				event = notify_event;
> +			ret = fanotify_get_response_from_access(group, event);
> +		}
>  	}

The overflow event should only have FS_Q_OVERFLOW set in it's mask right?  So
why is this test needed at all?  Thanks,

Josef

  parent reply	other threads:[~2011-10-13 13:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-13  8:56 [PATCH] fanotify: to differ file access event from different threads boyd yang
2011-10-13 13:27 ` boyd yang
2011-10-13 14:35   ` Américo Wang
2011-10-13 13:38 ` Josef Bacik [this message]
2011-10-14  6:56   ` boyd yang
2011-11-17 10:21     ` boyd yang
2011-11-24 14:58       ` Jan Kara
2011-12-06  1:24         ` boyd yang
  -- strict thread matches above, loose matches on Subject: below --
2011-12-06  1:23 boyd yang
2011-12-10 16:25 ` Lino Sanfilippo
2013-02-11 19:49 ` Mihai Donțu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111013133815.GC2310@localhost.localdomain \
    --to=josef@redhat.com \
    --cc=boyd.yang@gmail.com \
    --cc=eparis@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).