From: Al Viro Date: Wed, 9 Mar 2016 22:58:49 +0000 (-0500) Subject: untangle fsnotify_d_instantiate() a bit X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=27f203f655a2e1dab66598a5b19afb637c587f0b;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git untangle fsnotify_d_instantiate() a bit First of all, don't bother calling it if inode is NULL - that makes inode argument unused. Moreover, do it *before* dropping ->d_lock, not right after that (and don't bother grabbing ->d_lock in it, of course). Signed-off-by: Al Viro --- diff --git a/fs/dcache.c b/fs/dcache.c index 12280df07837..244fd2487fe9 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1750,8 +1750,9 @@ static void __d_instantiate(struct dentry *dentry, struct inode *inode) raw_write_seqcount_begin(&dentry->d_seq); __d_set_inode_and_type(dentry, inode, add_flags); raw_write_seqcount_end(&dentry->d_seq); + if (inode) + __fsnotify_d_instantiate(dentry); spin_unlock(&dentry->d_lock); - fsnotify_d_instantiate(dentry, inode); } /** diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 7ee1774edee5..0141f257d67b 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h @@ -16,15 +16,6 @@ #include #include -/* - * fsnotify_d_instantiate - instantiate a dentry for inode - */ -static inline void fsnotify_d_instantiate(struct dentry *dentry, - struct inode *inode) -{ - __fsnotify_d_instantiate(dentry, inode); -} - /* Notify this dentry's parent about a child's events. */ static inline int fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask) { diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index 6b7e89f45aa4..827b249259f7 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h @@ -293,14 +293,9 @@ static inline void __fsnotify_update_dcache_flags(struct dentry *dentry) /* * fsnotify_d_instantiate - instantiate a dentry for inode */ -static inline void __fsnotify_d_instantiate(struct dentry *dentry, struct inode *inode) +static inline void __fsnotify_d_instantiate(struct dentry *dentry) { - if (!inode) - return; - - spin_lock(&dentry->d_lock); __fsnotify_update_dcache_flags(dentry); - spin_unlock(&dentry->d_lock); } /* called from fsnotify listeners, such as fanotify or dnotify */ @@ -399,7 +394,7 @@ static inline void __fsnotify_vfsmount_delete(struct vfsmount *mnt) static inline void __fsnotify_update_dcache_flags(struct dentry *dentry) {} -static inline void __fsnotify_d_instantiate(struct dentry *dentry, struct inode *inode) +static inline void __fsnotify_d_instantiate(struct dentry *dentry) {} static inline u32 fsnotify_get_cookie(void)