Skip to content

Commit

Permalink
fs: allow d_instantiate to be called with negative parent dentry
Browse files Browse the repository at this point in the history
The new fsnotify infrastructure (starting at 9058652) 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>
Signed-off-by: Eric Paris <eparis@redhat.com>
  • Loading branch information
Jeremy Kerr authored and Eric Paris committed Jun 29, 2009
1 parent 5298976 commit e6ce306
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/linux/fsnotify_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e6ce306

Please sign in to comment.