linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Paris <eparis@redhat.com>
To: Lino Sanfilippo <LinoSanfilippo@gmx.de>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fanotify: dont destroy mark when ignore mask is cleared
Date: Mon, 29 Nov 2010 15:45:31 -0500	[thread overview]
Message-ID: <1291063531.3248.30.camel@localhost.localdomain> (raw)
In-Reply-To: <20101124123151.GB26499@lsanfilippo.unix.rd.tt.avira.com>

On Wed, 2010-11-24 at 13:31 +0100, Lino Sanfilippo wrote:

> 2. I just realized that we cant simply call destroy_mark() if the masks are 0. 
> There may be one or more concurrent processes calling fsnotify_find_inode_mark() 
> (see fanotify_add_inode_mark()) and get the mark we are about to destroy at the 
> same time.
> 
> I will take a closer look at it, but it seems to be difficult to me to safely 
> call destroy_mark() as long as we are not in the context of fanotify_release() (in 
> which we dont have to deal with concurrency like that any more). 

I guess it is a question of safe vs racy.  Yes it is safe, nothing will
explode or panic.  But we might have a race between one task removing an
event type causing the mask to go to 0 and we should destroy the mark
and another task adding an event type.  If it raced just right we might
destroy the mark after the second task added to it.  I guess we really
need to serialize fsnotify_mark() per group to solve the race...

Do you want to take a stab at fixing these things or should I?

-Eric

  reply	other threads:[~2010-11-29 20:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-22 17:52 [PATCH] fanotify: dont destroy mark when ignore mask is cleared Lino Sanfilippo
2010-11-23 19:51 ` Eric Paris
2010-11-24 12:31   ` Lino Sanfilippo
2010-11-29 20:45     ` Eric Paris [this message]
     [not found] <20101130121635.277910@gmx.net>
2010-11-30 15:59 ` Lino Sanfilippo
2010-11-30 16:19   ` Eric Paris

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=1291063531.3248.30.camel@localhost.localdomain \
    --to=eparis@redhat.com \
    --cc=LinoSanfilippo@gmx.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@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).