diff --git a/fs/namei.c b/fs/namei.c index 4a27eb798118957544d52c9edbe013f30ce9cc43..83559dce4286ccaf282070363deb9a7d5c525ba0 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1801,8 +1801,8 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry) } up(&dentry->d_inode->i_sem); if (!error) { - fsnotify_rmdir(dentry, dentry->d_inode, dir); d_delete(dentry); + fsnotify_rmdir(dentry, dentry->d_inode, dir); } dput(dentry); @@ -1874,8 +1874,14 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry) /* We don't d_delete() NFS sillyrenamed files--they still exist. */ if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) { +#if defined(CONFIG_INOTIFY) || defined(CONFIG_DNOTIFY) + dget(dentry); + d_delete(dentry); fsnotify_unlink(dentry, dir); + dput(dentry); +#else d_delete(dentry); +#endif } return error;