All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fs: allow d_instantiate to be called with negative parent dentry
@ 2009-06-29  6:31 Jeremy Kerr
  2009-06-29 13:45 ` Eric Paris
  0 siblings, 1 reply; 2+ messages in thread
From: Jeremy Kerr @ 2009-06-29  6:31 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, Eric Paris, Christoph Hellwig, cbe-oss-dev

The new fsnotify infrastructure (starting at 90586523) causes an oops in
spufs, where we populate a directory with files before instantiating the
directory itself. The new changes seem to have introduced an assumption
that a dentry's parent will be positive when instantiating.

This change makes it once again possible to d_instantiate a dentry
with a negative parent, and brings __fsnotify_d_instantiate() into
line with inotify_d_instantiate(), which already has this NULL check.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

---
Apologies for the resend, fixed lkml address

---
 include/linux/fsnotify_backend.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index 44848aa..6c3de99 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -280,7 +280,7 @@ static inline void __fsnotify_update_dcache_flags(struct dentry *dentry)
 	assert_spin_locked(&dentry->d_lock);
 
 	parent = dentry->d_parent;
-	if (fsnotify_inode_watches_children(parent->d_inode))
+	if (parent->d_inode && fsnotify_inode_watches_children(parent->d_inode))
 		dentry->d_flags |= DCACHE_FSNOTIFY_PARENT_WATCHED;
 	else
 		dentry->d_flags &= ~DCACHE_FSNOTIFY_PARENT_WATCHED;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fs: allow d_instantiate to be called with negative parent dentry
  2009-06-29  6:31 [PATCH] fs: allow d_instantiate to be called with negative parent dentry Jeremy Kerr
@ 2009-06-29 13:45 ` Eric Paris
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Paris @ 2009-06-29 13:45 UTC (permalink / raw)
  To: Jeremy Kerr; +Cc: linux-kernel, Andrew Morton, Christoph Hellwig, cbe-oss-dev

On Mon, 2009-06-29 at 14:31 +0800, Jeremy Kerr wrote:
> The new fsnotify infrastructure (starting at 90586523) causes an oops in
> spufs, where we populate a directory with files before instantiating the
> directory itself. The new changes seem to have introduced an assumption
> that a dentry's parent will be positive when instantiating.
> 
> This change makes it once again possible to d_instantiate a dentry
> with a negative parent, and brings __fsnotify_d_instantiate() into
> line with inotify_d_instantiate(), which already has this NULL check.
> 
> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

This problem was introduced based on a private off list comment from Al
Viro back on Feb 17th when he was reviewing my code:

fsnotify_d_instantiate(): check for NULL inode in parent?  Really?
BTW, where's the codepath without that stuff?  I mean, for sane
boxen that have *notify configured out.  Idiotify is at least
configurable away...

>From that comment I dropped the check for dentry->d_parent->d_inode.
The old behavior (which inotify had) is exactly what you propose and
would cause no problems for anything.  I'll leave it up to Al if he
wants to argue that the spufs logic is illegal but I'll put this patch
into my tree and send it toward Linus.

-Eric


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-06-29 13:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-29  6:31 [PATCH] fs: allow d_instantiate to be called with negative parent dentry Jeremy Kerr
2009-06-29 13:45 ` Eric Paris

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.