diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-03-09 17:58:49 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-03-14 00:17:28 -0400 |
commit | 27f203f655a2e1dab66598a5b19afb637c587f0b (patch) | |
tree | a022bd5f91af856da9cd9e31329850bcc0163873 | |
parent | 34d0d19dc0929ccc326448737f05a8fae3d47b8a (diff) |
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 <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/dcache.c | 3 | ||||
-rw-r--r-- | include/linux/fsnotify.h | 9 | ||||
-rw-r--r-- | include/linux/fsnotify_backend.h | 9 |
3 files changed, 4 insertions, 17 deletions
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) | |||
1750 | raw_write_seqcount_begin(&dentry->d_seq); | 1750 | raw_write_seqcount_begin(&dentry->d_seq); |
1751 | __d_set_inode_and_type(dentry, inode, add_flags); | 1751 | __d_set_inode_and_type(dentry, inode, add_flags); |
1752 | raw_write_seqcount_end(&dentry->d_seq); | 1752 | raw_write_seqcount_end(&dentry->d_seq); |
1753 | if (inode) | ||
1754 | __fsnotify_d_instantiate(dentry); | ||
1753 | spin_unlock(&dentry->d_lock); | 1755 | spin_unlock(&dentry->d_lock); |
1754 | fsnotify_d_instantiate(dentry, inode); | ||
1755 | } | 1756 | } |
1756 | 1757 | ||
1757 | /** | 1758 | /** |
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 @@ | |||
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | #include <linux/bug.h> | 17 | #include <linux/bug.h> |
18 | 18 | ||
19 | /* | ||
20 | * fsnotify_d_instantiate - instantiate a dentry for inode | ||
21 | */ | ||
22 | static inline void fsnotify_d_instantiate(struct dentry *dentry, | ||
23 | struct inode *inode) | ||
24 | { | ||
25 | __fsnotify_d_instantiate(dentry, inode); | ||
26 | } | ||
27 | |||
28 | /* Notify this dentry's parent about a child's events. */ | 19 | /* Notify this dentry's parent about a child's events. */ |
29 | static inline int fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask) | 20 | static inline int fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask) |
30 | { | 21 | { |
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) | |||
293 | /* | 293 | /* |
294 | * fsnotify_d_instantiate - instantiate a dentry for inode | 294 | * fsnotify_d_instantiate - instantiate a dentry for inode |
295 | */ | 295 | */ |
296 | static inline void __fsnotify_d_instantiate(struct dentry *dentry, struct inode *inode) | 296 | static inline void __fsnotify_d_instantiate(struct dentry *dentry) |
297 | { | 297 | { |
298 | if (!inode) | ||
299 | return; | ||
300 | |||
301 | spin_lock(&dentry->d_lock); | ||
302 | __fsnotify_update_dcache_flags(dentry); | 298 | __fsnotify_update_dcache_flags(dentry); |
303 | spin_unlock(&dentry->d_lock); | ||
304 | } | 299 | } |
305 | 300 | ||
306 | /* called from fsnotify listeners, such as fanotify or dnotify */ | 301 | /* called from fsnotify listeners, such as fanotify or dnotify */ |
@@ -399,7 +394,7 @@ static inline void __fsnotify_vfsmount_delete(struct vfsmount *mnt) | |||
399 | static inline void __fsnotify_update_dcache_flags(struct dentry *dentry) | 394 | static inline void __fsnotify_update_dcache_flags(struct dentry *dentry) |
400 | {} | 395 | {} |
401 | 396 | ||
402 | static inline void __fsnotify_d_instantiate(struct dentry *dentry, struct inode *inode) | 397 | static inline void __fsnotify_d_instantiate(struct dentry *dentry) |
403 | {} | 398 | {} |
404 | 399 | ||
405 | static inline u32 fsnotify_get_cookie(void) | 400 | static inline u32 fsnotify_get_cookie(void) |