public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Eric Paris <eparis@redhat.com>
Cc: linux-kernel@vger.kernel.org, hch@infradead.org,
	alan@lxorguk.ukuu.org.uk, sfr@canb.auug.org.au,
	john@johnmccutchan.com, rlove@rlove.org,
	akpm@linux-foundation.org
Subject: Re: [PATCH 04/13] fsnotify: add in inode fsnotify markings
Date: Mon, 23 Mar 2009 09:28:30 +0000	[thread overview]
Message-ID: <20090323092830.GN28946@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20090319180514.17449.34794.stgit@paris.rdu.redhat.com>

On Thu, Mar 19, 2009 at 02:05:14PM -0400, Eric Paris wrote:
> This patch creates in inode fsnotify markings.  dnotify will make use of in
> inode markings to mark which inodes it wishes to send events for.  fanotify
> will use this to mark which inodes it does not wish to send events for.

Hrm...  What happens if fsnotify_clear_marks_by_inode() is called, gets
the only mark we had for a group, removes it from all lists, drops all
locks and races with the final fsnotify_put_group()?  Said put_group
sees nothing whatsoever on the per-group mark list (the only mark we
used to have there is already evicted) and the group is cheerfully
freed.  Then fsnotify_destroy_mark_by_entry() calls
	group->ops->freeing_mark(entry, group)
with group already freed...  Gets really interesting in case of inotify -
there ->freeing_mark() leads to blocking allocations and really touches
group in non-trivial ways.

Note that for inotify ->freeing_mark() will happily add notification to
group's queue and that's another race of the same nature - even if
group itself isn't yet freed, that final put_group() might bloody well
get past flushing the queue.

I really don't like the idea of having marks contributing to group refcount -
that would have solved this one, but we'd get potential leaks from hell ;-/
Maybe a separate counter controlling only actual freeing of group?

  reply	other threads:[~2009-03-23  9:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-19 18:04 [PATCH 01/13] mutex: add atomic_dec_and_mutex_lock Eric Paris
2009-03-19 18:05 ` [PATCH 02/13] fsnotify: unified filesystem notification backend Eric Paris
2009-04-07 23:45   ` Paul E. McKenney
2009-03-19 18:05 ` [PATCH 03/13] fsnotify: add group priorities Eric Paris
2009-03-19 18:05 ` [PATCH 04/13] fsnotify: add in inode fsnotify markings Eric Paris
2009-03-23  9:28   ` Al Viro [this message]
2009-03-23  9:53     ` Al Viro
2009-03-19 18:05 ` [PATCH 05/13] fsnotify: parent event notification Eric Paris
2009-03-19 18:05 ` [PATCH 06/13] dnotify: reimplement dnotify using fsnotify Eric Paris
2009-03-19 18:05 ` [PATCH 07/13] fsnotify: generic notification queue and waitq Eric Paris
2009-03-19 18:05 ` [PATCH 08/13] fsnotify: include pathnames with entries when possible Eric Paris
2009-03-19 18:05 ` [PATCH 09/13] fsnotify: add correlations between events Eric Paris
2009-03-19 18:05 ` [PATCH 10/13] fsnotify: allow groups to add private data to events Eric Paris
2009-03-23 11:04   ` Al Viro
2009-03-19 18:05 ` [PATCH 11/13] fsnotify: fsnotify marks on inodes pin them in core Eric Paris
2009-03-19 18:05 ` [PATCH 12/13] fsnotify: handle filesystem unmounts with fsnotify marks Eric Paris
2009-03-19 18:06 ` [PATCH 13/13] inotify: reimplement inotify using fsnotify Eric Paris
2009-03-23 10:29   ` Al Viro

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=20090323092830.GN28946@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=eparis@redhat.com \
    --cc=hch@infradead.org \
    --cc=john@johnmccutchan.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rlove@rlove.org \
    --cc=sfr@canb.auug.org.au \
    /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