All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>,
	Marko Rauhamaa <marko.rauhamaa@f-secure.com>,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fsnotify: fix ignore mask logic in fsnotify()
Date: Mon, 3 Sep 2018 14:00:42 +0200	[thread overview]
Message-ID: <20180903120042.GH10027@quack2.suse.cz> (raw)
In-Reply-To: <20180901064001.23430-1-amir73il@gmail.com>

On Sat 01-09-18 09:40:01, Amir Goldstein wrote:
> Commit 92183a42898d ("fsnotify: fix ignore mask logic in
> send_to_group()") acknoledges the use case of ignoring an event on
> an inode mark, because of an ignore mask on a mount mark of the same
> group (i.e. I want to get all events on this file, except for the events
> that came from that mount).
> 
> This change depends on correctly merging the inode marks and mount marks
> group lists, so that the mount mark ignore mask would be tested in
> send_to_group(). Alas, the merging of the lists did not take into
> account the case where event in question is not in the mask of any of
> the mount marks.
> 
> To fix this, completely remove the tests for inode and mount event masks
> from the lists merging code.
> 
> Fixes: 92183a42898d ("fsnotify: fix ignore mask logic in send_to_group")
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>

Great, thanks. Added to my tree.

								Honza

> ---
> 
> Jan,
> 
> Posting this fix independent from the super block mark series,
> so you can send it in this cycle if you wish.
> 
> New LTP test fanotify10 from [1] demonstrates the problem and
> the fix. Note that the test verifies the expected behavior as
> agreed in this discussion [2].
> 
> Thanks,
> Amir.
> 
> [1] https://github.com/amir73il/ltp/commits/fanotify_sb
> [2] https://marc.info/?l=linux-fsdevel&m=152284295703053&w=2
> 
>  fs/notify/fsnotify.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c
> index 775e731d3016..2971803d151c 100644
> --- a/fs/notify/fsnotify.c
> +++ b/fs/notify/fsnotify.c
> @@ -357,16 +357,9 @@ int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is,
>  
>  	iter_info.srcu_idx = srcu_read_lock(&fsnotify_mark_srcu);
>  
> -	if ((mask & FS_MODIFY) ||
> -	    (test_mask & to_tell->i_fsnotify_mask)) {
> -		iter_info.marks[FSNOTIFY_OBJ_TYPE_INODE] =
> -			fsnotify_first_mark(&to_tell->i_fsnotify_marks);
> -	}
> -
> -	if (mnt && ((mask & FS_MODIFY) ||
> -		    (test_mask & mnt->mnt_fsnotify_mask))) {
> -		iter_info.marks[FSNOTIFY_OBJ_TYPE_INODE] =
> -			fsnotify_first_mark(&to_tell->i_fsnotify_marks);
> +	iter_info.marks[FSNOTIFY_OBJ_TYPE_INODE] =
> +		fsnotify_first_mark(&to_tell->i_fsnotify_marks);
> +	if (mnt) {
>  		iter_info.marks[FSNOTIFY_OBJ_TYPE_VFSMOUNT] =
>  			fsnotify_first_mark(&mnt->mnt_fsnotify_marks);
>  	}
> -- 
> 2.17.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

      reply	other threads:[~2018-09-03 16:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-01  6:40 [PATCH] fsnotify: fix ignore mask logic in fsnotify() Amir Goldstein
2018-09-03 12:00 ` Jan Kara [this message]

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=20180903120042.GH10027@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=amir73il@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=marko.rauhamaa@f-secure.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.