aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-08-07 10:01:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-08-07 10:01:14 -0400
commitfe64f3283fb315e3d8f2b78785a86904a852ca82 (patch)
tree3ab48823f0ef8b855f9b58809f09b9db2997f12e
parent0cbbc422d56668528f6efd1234fe908010284082 (diff)
parentdb20a8925bc420eed033c5d91ff6afa74465e521 (diff)
Merge branch 'for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull more vfs updates from Al Viro: "Assorted cleanups and fixes. In the "trivial API change" department - ->d_compare() losing 'parent' argument" * 'for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: cachefiles: Fix race between inactivating and culling a cache object 9p: use clone_fid() 9p: fix braino introduced in "9p: new helper - v9fs_parent_fid()" vfs: make dentry_needs_remove_privs() internal vfs: remove file_needs_remove_privs() vfs: fix deadlock in file_remove_privs() on overlayfs get rid of 'parent' argument of ->d_compare() cifs, msdos, vfat, hfs+: don't bother with parent in ->d_compare() affs ->d_compare(): don't bother with ->d_inode fold _d_rehash() and __d_rehash() together fold dentry_rcuwalk_invalidate() into its only remaining caller
-rw-r--r--Documentation/filesystems/Locking2
-rw-r--r--Documentation/filesystems/porting7
-rw-r--r--Documentation/filesystems/vfs.txt2
-rw-r--r--drivers/staging/lustre/lustre/llite/dcache.c2
-rw-r--r--fs/9p/fid.c26
-rw-r--r--fs/9p/fid.h9
-rw-r--r--fs/9p/vfs_inode.c6
-rw-r--r--fs/9p/vfs_inode_dotl.c2
-rw-r--r--fs/9p/xattr.c4
-rw-r--r--fs/adfs/dir.c2
-rw-r--r--fs/affs/amigaffs.c4
-rw-r--r--fs/affs/namei.c12
-rw-r--r--fs/cachefiles/namei.c5
-rw-r--r--fs/cifs/dir.c4
-rw-r--r--fs/dcache.c55
-rw-r--r--fs/efivarfs/super.c3
-rw-r--r--fs/fat/namei_msdos.c4
-rw-r--r--fs/fat/namei_vfat.c6
-rw-r--r--fs/hfs/hfs_fs.h2
-rw-r--r--fs/hfs/string.c2
-rw-r--r--fs/hfsplus/hfsplus_fs.h3
-rw-r--r--fs/hfsplus/unicode.c4
-rw-r--r--fs/hpfs/dentry.c4
-rw-r--r--fs/inode.c7
-rw-r--r--fs/internal.h1
-rw-r--r--fs/isofs/inode.c15
-rw-r--r--fs/isofs/namei.c2
-rw-r--r--fs/jfs/namei.c2
-rw-r--r--fs/ncpfs/dir.c6
-rw-r--r--fs/proc/proc_sysctl.c2
-rw-r--r--include/linux/dcache.h2
-rw-r--r--include/linux/fs.h5
32 files changed, 82 insertions, 130 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index 1b3c39a7de62..d30fb2cb5066 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -12,7 +12,7 @@ prototypes:
12 int (*d_revalidate)(struct dentry *, unsigned int); 12 int (*d_revalidate)(struct dentry *, unsigned int);
13 int (*d_weak_revalidate)(struct dentry *, unsigned int); 13 int (*d_weak_revalidate)(struct dentry *, unsigned int);
14 int (*d_hash)(const struct dentry *, struct qstr *); 14 int (*d_hash)(const struct dentry *, struct qstr *);
15 int (*d_compare)(const struct dentry *, const struct dentry *, 15 int (*d_compare)(const struct dentry *,
16 unsigned int, const char *, const struct qstr *); 16 unsigned int, const char *, const struct qstr *);
17 int (*d_delete)(struct dentry *); 17 int (*d_delete)(struct dentry *);
18 int (*d_init)(struct dentry *); 18 int (*d_init)(struct dentry *);
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting
index a5fb89cac615..b1bd05ea66b2 100644
--- a/Documentation/filesystems/porting
+++ b/Documentation/filesystems/porting
@@ -585,3 +585,10 @@ in your dentry operations instead.
585 in the instances. Rationale: !@#!@# security_d_instantiate() needs to be 585 in the instances. Rationale: !@#!@# security_d_instantiate() needs to be
586 called before we attach dentry to inode and !@#!@##!@$!$#!@#$!@$!@$ smack 586 called before we attach dentry to inode and !@#!@##!@$!$#!@#$!@$!@$ smack
587 ->d_instantiate() uses not just ->getxattr() but ->setxattr() as well. 587 ->d_instantiate() uses not just ->getxattr() but ->setxattr() as well.
588--
589[mandatory]
590 ->d_compare() doesn't get parent as a separate argument anymore. If you
591 used it for finding the struct super_block involved, dentry->d_sb will
592 work just as well; if it's something more complicated, use dentry->d_parent.
593 Just be careful not to assume that fetching it more than once will yield
594 the same value - in RCU mode it could change under you.
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index 8a196851f01d..9ace359d6cc5 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -931,7 +931,7 @@ struct dentry_operations {
931 int (*d_revalidate)(struct dentry *, unsigned int); 931 int (*d_revalidate)(struct dentry *, unsigned int);
932 int (*d_weak_revalidate)(struct dentry *, unsigned int); 932 int (*d_weak_revalidate)(struct dentry *, unsigned int);
933 int (*d_hash)(const struct dentry *, struct qstr *); 933 int (*d_hash)(const struct dentry *, struct qstr *);
934 int (*d_compare)(const struct dentry *, const struct dentry *, 934 int (*d_compare)(const struct dentry *,
935 unsigned int, const char *, const struct qstr *); 935 unsigned int, const char *, const struct qstr *);
936 int (*d_delete)(const struct dentry *); 936 int (*d_delete)(const struct dentry *);
937 int (*d_init)(struct dentry *); 937 int (*d_init)(struct dentry *);
diff --git a/drivers/staging/lustre/lustre/llite/dcache.c b/drivers/staging/lustre/lustre/llite/dcache.c
index 581a63a0a63e..463b1a360733 100644
--- a/drivers/staging/lustre/lustre/llite/dcache.c
+++ b/drivers/staging/lustre/lustre/llite/dcache.c
@@ -78,7 +78,7 @@ static void ll_release(struct dentry *de)
78 * INVALID) so d_lookup() matches it, but we have no lock on it (so 78 * INVALID) so d_lookup() matches it, but we have no lock on it (so
79 * lock_match() fails) and we spin around real_lookup(). 79 * lock_match() fails) and we spin around real_lookup().
80 */ 80 */
81static int ll_dcompare(const struct dentry *parent, const struct dentry *dentry, 81static int ll_dcompare(const struct dentry *dentry,
82 unsigned int len, const char *str, 82 unsigned int len, const char *str,
83 const struct qstr *name) 83 const struct qstr *name)
84{ 84{
diff --git a/fs/9p/fid.c b/fs/9p/fid.c
index 47db55aee7f2..60fb47469c86 100644
--- a/fs/9p/fid.c
+++ b/fs/9p/fid.c
@@ -257,36 +257,12 @@ struct p9_fid *v9fs_fid_lookup(struct dentry *dentry)
257 return v9fs_fid_lookup_with_uid(dentry, uid, any); 257 return v9fs_fid_lookup_with_uid(dentry, uid, any);
258} 258}
259 259
260struct p9_fid *v9fs_fid_clone(struct dentry *dentry)
261{
262 struct p9_fid *fid, *ret;
263
264 fid = v9fs_fid_lookup(dentry);
265 if (IS_ERR(fid))
266 return fid;
267
268 ret = p9_client_walk(fid, 0, NULL, 1);
269 return ret;
270}
271
272static struct p9_fid *v9fs_fid_clone_with_uid(struct dentry *dentry, kuid_t uid)
273{
274 struct p9_fid *fid, *ret;
275
276 fid = v9fs_fid_lookup_with_uid(dentry, uid, 0);
277 if (IS_ERR(fid))
278 return fid;
279
280 ret = p9_client_walk(fid, 0, NULL, 1);
281 return ret;
282}
283
284struct p9_fid *v9fs_writeback_fid(struct dentry *dentry) 260struct p9_fid *v9fs_writeback_fid(struct dentry *dentry)
285{ 261{
286 int err; 262 int err;
287 struct p9_fid *fid; 263 struct p9_fid *fid;
288 264
289 fid = v9fs_fid_clone_with_uid(dentry, GLOBAL_ROOT_UID); 265 fid = clone_fid(v9fs_fid_lookup_with_uid(dentry, GLOBAL_ROOT_UID, 0));
290 if (IS_ERR(fid)) 266 if (IS_ERR(fid))
291 goto error_out; 267 goto error_out;
292 /* 268 /*
diff --git a/fs/9p/fid.h b/fs/9p/fid.h
index 12700df0bb51..4491bcaf42b8 100644
--- a/fs/9p/fid.h
+++ b/fs/9p/fid.h
@@ -28,7 +28,14 @@ static inline struct p9_fid *v9fs_parent_fid(struct dentry *dentry)
28{ 28{
29 return v9fs_fid_lookup(dentry->d_parent); 29 return v9fs_fid_lookup(dentry->d_parent);
30} 30}
31struct p9_fid *v9fs_fid_clone(struct dentry *dentry);
32void v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid); 31void v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid);
33struct p9_fid *v9fs_writeback_fid(struct dentry *dentry); 32struct p9_fid *v9fs_writeback_fid(struct dentry *dentry);
33static inline struct p9_fid *clone_fid(struct p9_fid *fid)
34{
35 return IS_ERR(fid) ? fid : p9_client_walk(fid, 0, NULL, 1);
36}
37static inline struct p9_fid *v9fs_fid_clone(struct dentry *dentry)
38{
39 return clone_fid(v9fs_fid_lookup(dentry));
40}
34#endif 41#endif
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 7da9a8354fad..8b1999b528e9 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -661,7 +661,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
661 } 661 }
662 662
663 /* clone a fid to use for creation */ 663 /* clone a fid to use for creation */
664 ofid = p9_client_walk(dfid, 0, NULL, 1); 664 ofid = clone_fid(dfid);
665 if (IS_ERR(ofid)) { 665 if (IS_ERR(ofid)) {
666 err = PTR_ERR(ofid); 666 err = PTR_ERR(ofid);
667 p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); 667 p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
@@ -975,13 +975,13 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
975 if (IS_ERR(oldfid)) 975 if (IS_ERR(oldfid))
976 return PTR_ERR(oldfid); 976 return PTR_ERR(oldfid);
977 977
978 olddirfid = v9fs_parent_fid(old_dentry); 978 olddirfid = clone_fid(v9fs_parent_fid(old_dentry));
979 if (IS_ERR(olddirfid)) { 979 if (IS_ERR(olddirfid)) {
980 retval = PTR_ERR(olddirfid); 980 retval = PTR_ERR(olddirfid);
981 goto done; 981 goto done;
982 } 982 }
983 983
984 newdirfid = v9fs_parent_fid(new_dentry); 984 newdirfid = clone_fid(v9fs_parent_fid(new_dentry));
985 if (IS_ERR(newdirfid)) { 985 if (IS_ERR(newdirfid)) {
986 retval = PTR_ERR(newdirfid); 986 retval = PTR_ERR(newdirfid);
987 goto clunk_olddir; 987 goto clunk_olddir;
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 2ed04c2fe7af..eeabcb0bad12 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -281,7 +281,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
281 } 281 }
282 282
283 /* clone a fid to use for creation */ 283 /* clone a fid to use for creation */
284 ofid = p9_client_walk(dfid, 0, NULL, 1); 284 ofid = clone_fid(dfid);
285 if (IS_ERR(ofid)) { 285 if (IS_ERR(ofid)) {
286 err = PTR_ERR(ofid); 286 err = PTR_ERR(ofid);
287 p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); 287 p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
diff --git a/fs/9p/xattr.c b/fs/9p/xattr.c
index a6bd349bab23..f329eee6dc93 100644
--- a/fs/9p/xattr.c
+++ b/fs/9p/xattr.c
@@ -97,8 +97,6 @@ int v9fs_xattr_set(struct dentry *dentry, const char *name,
97 const void *value, size_t value_len, int flags) 97 const void *value, size_t value_len, int flags)
98{ 98{
99 struct p9_fid *fid = v9fs_fid_lookup(dentry); 99 struct p9_fid *fid = v9fs_fid_lookup(dentry);
100 if (IS_ERR(fid))
101 return PTR_ERR(fid);
102 return v9fs_fid_xattr_set(fid, name, value, value_len, flags); 100 return v9fs_fid_xattr_set(fid, name, value, value_len, flags);
103} 101}
104 102
@@ -115,7 +113,7 @@ int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name,
115 name, value_len, flags); 113 name, value_len, flags);
116 114
117 /* Clone it */ 115 /* Clone it */
118 fid = p9_client_walk(fid, 0, NULL, 1); 116 fid = clone_fid(fid);
119 if (IS_ERR(fid)) 117 if (IS_ERR(fid))
120 return PTR_ERR(fid); 118 return PTR_ERR(fid);
121 119
diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c
index c39aedc7ed3d..29444c83da48 100644
--- a/fs/adfs/dir.c
+++ b/fs/adfs/dir.c
@@ -227,7 +227,7 @@ adfs_hash(const struct dentry *parent, struct qstr *qstr)
227 * requirements of the underlying filesystem. 227 * requirements of the underlying filesystem.
228 */ 228 */
229static int 229static int
230adfs_compare(const struct dentry *parent, const struct dentry *dentry, 230adfs_compare(const struct dentry *dentry,
231 unsigned int len, const char *str, const struct qstr *name) 231 unsigned int len, const char *str, const struct qstr *name)
232{ 232{
233 int i; 233 int i;
diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c
index d6c7a51c93e4..d8f217c711d3 100644
--- a/fs/affs/amigaffs.c
+++ b/fs/affs/amigaffs.c
@@ -472,9 +472,7 @@ affs_warning(struct super_block *sb, const char *function, const char *fmt, ...)
472bool 472bool
473affs_nofilenametruncate(const struct dentry *dentry) 473affs_nofilenametruncate(const struct dentry *dentry)
474{ 474{
475 struct inode *inode = d_inode(dentry); 475 return affs_test_opt(AFFS_SB(dentry->d_sb)->s_flags, SF_NO_TRUNCATE);
476
477 return affs_test_opt(AFFS_SB(inode->i_sb)->s_flags, SF_NO_TRUNCATE);
478} 476}
479 477
480/* Check if the name is valid for a affs object. */ 478/* Check if the name is valid for a affs object. */
diff --git a/fs/affs/namei.c b/fs/affs/namei.c
index eb32029bc776..a2d68f828d53 100644
--- a/fs/affs/namei.c
+++ b/fs/affs/namei.c
@@ -14,11 +14,11 @@ typedef int (*toupper_t)(int);
14 14
15static int affs_toupper(int ch); 15static int affs_toupper(int ch);
16static int affs_hash_dentry(const struct dentry *, struct qstr *); 16static int affs_hash_dentry(const struct dentry *, struct qstr *);
17static int affs_compare_dentry(const struct dentry *parent, const struct dentry *dentry, 17static int affs_compare_dentry(const struct dentry *dentry,
18 unsigned int len, const char *str, const struct qstr *name); 18 unsigned int len, const char *str, const struct qstr *name);
19static int affs_intl_toupper(int ch); 19static int affs_intl_toupper(int ch);
20static int affs_intl_hash_dentry(const struct dentry *, struct qstr *); 20static int affs_intl_hash_dentry(const struct dentry *, struct qstr *);
21static int affs_intl_compare_dentry(const struct dentry *parent, const struct dentry *dentry, 21static int affs_intl_compare_dentry(const struct dentry *dentry,
22 unsigned int len, const char *str, const struct qstr *name); 22 unsigned int len, const char *str, const struct qstr *name);
23 23
24const struct dentry_operations affs_dentry_operations = { 24const struct dentry_operations affs_dentry_operations = {
@@ -131,20 +131,20 @@ static inline int __affs_compare_dentry(unsigned int len,
131} 131}
132 132
133static int 133static int
134affs_compare_dentry(const struct dentry *parent, const struct dentry *dentry, 134affs_compare_dentry(const struct dentry *dentry,
135 unsigned int len, const char *str, const struct qstr *name) 135 unsigned int len, const char *str, const struct qstr *name)
136{ 136{
137 137
138 return __affs_compare_dentry(len, str, name, affs_toupper, 138 return __affs_compare_dentry(len, str, name, affs_toupper,
139 affs_nofilenametruncate(parent)); 139 affs_nofilenametruncate(dentry));
140} 140}
141 141
142static int 142static int
143affs_intl_compare_dentry(const struct dentry *parent, const struct dentry *dentry, 143affs_intl_compare_dentry(const struct dentry *dentry,
144 unsigned int len, const char *str, const struct qstr *name) 144 unsigned int len, const char *str, const struct qstr *name)
145{ 145{
146 return __affs_compare_dentry(len, str, name, affs_intl_toupper, 146 return __affs_compare_dentry(len, str, name, affs_intl_toupper,
147 affs_nofilenametruncate(parent)); 147 affs_nofilenametruncate(dentry));
148 148
149} 149}
150 150
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c
index 4ae75006e73b..3f7c2cd41f8f 100644
--- a/fs/cachefiles/namei.c
+++ b/fs/cachefiles/namei.c
@@ -263,6 +263,8 @@ requeue:
263void cachefiles_mark_object_inactive(struct cachefiles_cache *cache, 263void cachefiles_mark_object_inactive(struct cachefiles_cache *cache,
264 struct cachefiles_object *object) 264 struct cachefiles_object *object)
265{ 265{
266 blkcnt_t i_blocks = d_backing_inode(object->dentry)->i_blocks;
267
266 write_lock(&cache->active_lock); 268 write_lock(&cache->active_lock);
267 rb_erase(&object->active_node, &cache->active_nodes); 269 rb_erase(&object->active_node, &cache->active_nodes);
268 clear_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags); 270 clear_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags);
@@ -273,8 +275,7 @@ void cachefiles_mark_object_inactive(struct cachefiles_cache *cache,
273 /* This object can now be culled, so we need to let the daemon know 275 /* This object can now be culled, so we need to let the daemon know
274 * that there is something it can remove if it needs to. 276 * that there is something it can remove if it needs to.
275 */ 277 */
276 atomic_long_add(d_backing_inode(object->dentry)->i_blocks, 278 atomic_long_add(i_blocks, &cache->b_released);
277 &cache->b_released);
278 if (atomic_inc_return(&cache->f_released)) 279 if (atomic_inc_return(&cache->f_released))
279 cachefiles_state_changed(cache); 280 cachefiles_state_changed(cache);
280} 281}
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 4e532536cbc6..4716c54dbfc6 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -903,10 +903,10 @@ static int cifs_ci_hash(const struct dentry *dentry, struct qstr *q)
903 return 0; 903 return 0;
904} 904}
905 905
906static int cifs_ci_compare(const struct dentry *parent, const struct dentry *dentry, 906static int cifs_ci_compare(const struct dentry *dentry,
907 unsigned int len, const char *str, const struct qstr *name) 907 unsigned int len, const char *str, const struct qstr *name)
908{ 908{
909 struct nls_table *codepage = CIFS_SB(parent->d_sb)->local_nls; 909 struct nls_table *codepage = CIFS_SB(dentry->d_sb)->local_nls;
910 wchar_t c1, c2; 910 wchar_t c1, c2;
911 int i, l1, l2; 911 int i, l1, l2;
912 912
diff --git a/fs/dcache.c b/fs/dcache.c
index 96635a30fb26..5c7cc953ac81 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -316,20 +316,6 @@ static void dentry_free(struct dentry *dentry)
316 call_rcu(&dentry->d_u.d_rcu, __d_free); 316 call_rcu(&dentry->d_u.d_rcu, __d_free);
317} 317}
318 318
319/**
320 * dentry_rcuwalk_invalidate - invalidate in-progress rcu-walk lookups
321 * @dentry: the target dentry
322 * After this call, in-progress rcu-walk path lookup will fail. This
323 * should be called after unhashing, and after changing d_inode (if
324 * the dentry has not already been unhashed).
325 */
326static inline void dentry_rcuwalk_invalidate(struct dentry *dentry)
327{
328 lockdep_assert_held(&dentry->d_lock);
329 /* Go through am invalidation barrier */
330 write_seqcount_invalidate(&dentry->d_seq);
331}
332
333/* 319/*
334 * Release the dentry's inode, using the filesystem 320 * Release the dentry's inode, using the filesystem
335 * d_iput() operation if defined. 321 * d_iput() operation if defined.
@@ -468,7 +454,8 @@ void __d_drop(struct dentry *dentry)
468 __hlist_bl_del(&dentry->d_hash); 454 __hlist_bl_del(&dentry->d_hash);
469 dentry->d_hash.pprev = NULL; 455 dentry->d_hash.pprev = NULL;
470 hlist_bl_unlock(b); 456 hlist_bl_unlock(b);
471 dentry_rcuwalk_invalidate(dentry); 457 /* After this call, in-progress rcu-walk path lookup will fail. */
458 write_seqcount_invalidate(&dentry->d_seq);
472 } 459 }
473} 460}
474EXPORT_SYMBOL(__d_drop); 461EXPORT_SYMBOL(__d_drop);
@@ -2060,7 +2047,7 @@ static inline bool d_same_name(const struct dentry *dentry,
2060 return false; 2047 return false;
2061 return dentry_cmp(dentry, name->name, name->len) == 0; 2048 return dentry_cmp(dentry, name->name, name->len) == 0;
2062 } 2049 }
2063 return parent->d_op->d_compare(parent, dentry, 2050 return parent->d_op->d_compare(dentry,
2064 dentry->d_name.len, dentry->d_name.name, 2051 dentry->d_name.len, dentry->d_name.name,
2065 name) == 0; 2052 name) == 0;
2066} 2053}
@@ -2163,7 +2150,7 @@ seqretry:
2163 cpu_relax(); 2150 cpu_relax();
2164 goto seqretry; 2151 goto seqretry;
2165 } 2152 }
2166 if (parent->d_op->d_compare(parent, dentry, 2153 if (parent->d_op->d_compare(dentry,
2167 tlen, tname, name) != 0) 2154 tlen, tname, name) != 0)
2168 continue; 2155 continue;
2169 } else { 2156 } else {
@@ -2352,19 +2339,15 @@ again:
2352} 2339}
2353EXPORT_SYMBOL(d_delete); 2340EXPORT_SYMBOL(d_delete);
2354 2341
2355static void __d_rehash(struct dentry * entry, struct hlist_bl_head *b) 2342static void __d_rehash(struct dentry *entry)
2356{ 2343{
2344 struct hlist_bl_head *b = d_hash(entry->d_name.hash);
2357 BUG_ON(!d_unhashed(entry)); 2345 BUG_ON(!d_unhashed(entry));
2358 hlist_bl_lock(b); 2346 hlist_bl_lock(b);
2359 hlist_bl_add_head_rcu(&entry->d_hash, b); 2347 hlist_bl_add_head_rcu(&entry->d_hash, b);
2360 hlist_bl_unlock(b); 2348 hlist_bl_unlock(b);
2361} 2349}
2362 2350
2363static void _d_rehash(struct dentry * entry)
2364{
2365 __d_rehash(entry, d_hash(entry->d_name.hash));
2366}
2367
2368/** 2351/**
2369 * d_rehash - add an entry back to the hash 2352 * d_rehash - add an entry back to the hash
2370 * @entry: dentry to add to the hash 2353 * @entry: dentry to add to the hash
@@ -2375,7 +2358,7 @@ static void _d_rehash(struct dentry * entry)
2375void d_rehash(struct dentry * entry) 2358void d_rehash(struct dentry * entry)
2376{ 2359{
2377 spin_lock(&entry->d_lock); 2360 spin_lock(&entry->d_lock);
2378 _d_rehash(entry); 2361 __d_rehash(entry);
2379 spin_unlock(&entry->d_lock); 2362 spin_unlock(&entry->d_lock);
2380} 2363}
2381EXPORT_SYMBOL(d_rehash); 2364EXPORT_SYMBOL(d_rehash);
@@ -2549,7 +2532,7 @@ static inline void __d_add(struct dentry *dentry, struct inode *inode)
2549 raw_write_seqcount_end(&dentry->d_seq); 2532 raw_write_seqcount_end(&dentry->d_seq);
2550 fsnotify_update_flags(dentry); 2533 fsnotify_update_flags(dentry);
2551 } 2534 }
2552 _d_rehash(dentry); 2535 __d_rehash(dentry);
2553 if (dir) 2536 if (dir)
2554 end_dir_add(dir, n); 2537 end_dir_add(dir, n);
2555 spin_unlock(&dentry->d_lock); 2538 spin_unlock(&dentry->d_lock);
@@ -2611,7 +2594,7 @@ struct dentry *d_exact_alias(struct dentry *entry, struct inode *inode)
2611 alias = NULL; 2594 alias = NULL;
2612 } else { 2595 } else {
2613 __dget_dlock(alias); 2596 __dget_dlock(alias);
2614 _d_rehash(alias); 2597 __d_rehash(alias);
2615 spin_unlock(&alias->d_lock); 2598 spin_unlock(&alias->d_lock);
2616 } 2599 }
2617 spin_unlock(&inode->i_lock); 2600 spin_unlock(&inode->i_lock);
@@ -2795,23 +2778,10 @@ static void __d_move(struct dentry *dentry, struct dentry *target,
2795 write_seqcount_begin(&dentry->d_seq); 2778 write_seqcount_begin(&dentry->d_seq);
2796 write_seqcount_begin_nested(&target->d_seq, DENTRY_D_LOCK_NESTED); 2779 write_seqcount_begin_nested(&target->d_seq, DENTRY_D_LOCK_NESTED);
2797 2780
2781 /* unhash both */
2798 /* __d_drop does write_seqcount_barrier, but they're OK to nest. */ 2782 /* __d_drop does write_seqcount_barrier, but they're OK to nest. */
2799
2800 /*
2801 * Move the dentry to the target hash queue. Don't bother checking
2802 * for the same hash queue because of how unlikely it is.
2803 */
2804 __d_drop(dentry); 2783 __d_drop(dentry);
2805 __d_rehash(dentry, d_hash(target->d_name.hash));
2806
2807 /*
2808 * Unhash the target (d_delete() is not usable here). If exchanging
2809 * the two dentries, then rehash onto the other's hash queue.
2810 */
2811 __d_drop(target); 2784 __d_drop(target);
2812 if (exchange) {
2813 __d_rehash(target, d_hash(dentry->d_name.hash));
2814 }
2815 2785
2816 /* Switch the names.. */ 2786 /* Switch the names.. */
2817 if (exchange) 2787 if (exchange)
@@ -2819,6 +2789,11 @@ static void __d_move(struct dentry *dentry, struct dentry *target,
2819 else 2789 else
2820 copy_name(dentry, target); 2790 copy_name(dentry, target);
2821 2791
2792 /* rehash in new place(s) */
2793 __d_rehash(dentry);
2794 if (exchange)
2795 __d_rehash(target);
2796
2822 /* ... and switch them in the tree */ 2797 /* ... and switch them in the tree */
2823 if (IS_ROOT(dentry)) { 2798 if (IS_ROOT(dentry)) {
2824 /* splicing a tree */ 2799 /* splicing a tree */
diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c
index a5e607e8f056..688ccc16b702 100644
--- a/fs/efivarfs/super.c
+++ b/fs/efivarfs/super.c
@@ -45,8 +45,7 @@ static struct super_block *efivarfs_sb;
45 * So we need to perform a case-sensitive match on part 1 and a 45 * So we need to perform a case-sensitive match on part 1 and a
46 * case-insensitive match on part 2. 46 * case-insensitive match on part 2.
47 */ 47 */
48static int efivarfs_d_compare(const struct dentry *parent, 48static int efivarfs_d_compare(const struct dentry *dentry,
49 const struct dentry *dentry,
50 unsigned int len, const char *str, 49 unsigned int len, const char *str,
51 const struct qstr *name) 50 const struct qstr *name)
52{ 51{
diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c
index 1337c0c7527d..664655b2c55f 100644
--- a/fs/fat/namei_msdos.c
+++ b/fs/fat/namei_msdos.c
@@ -162,10 +162,10 @@ static int msdos_hash(const struct dentry *dentry, struct qstr *qstr)
162 * Compare two msdos names. If either of the names are invalid, 162 * Compare two msdos names. If either of the names are invalid,
163 * we fall back to doing the standard name comparison. 163 * we fall back to doing the standard name comparison.
164 */ 164 */
165static int msdos_cmp(const struct dentry *parent, const struct dentry *dentry, 165static int msdos_cmp(const struct dentry *dentry,
166 unsigned int len, const char *str, const struct qstr *name) 166 unsigned int len, const char *str, const struct qstr *name)
167{ 167{
168 struct fat_mount_options *options = &MSDOS_SB(parent->d_sb)->options; 168 struct fat_mount_options *options = &MSDOS_SB(dentry->d_sb)->options;
169 unsigned char a_msdos_name[MSDOS_NAME], b_msdos_name[MSDOS_NAME]; 169 unsigned char a_msdos_name[MSDOS_NAME], b_msdos_name[MSDOS_NAME];
170 int error; 170 int error;
171 171
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c
index 092b911f5c4e..92b7363dafa9 100644
--- a/fs/fat/namei_vfat.c
+++ b/fs/fat/namei_vfat.c
@@ -138,10 +138,10 @@ static int vfat_hashi(const struct dentry *dentry, struct qstr *qstr)
138/* 138/*
139 * Case insensitive compare of two vfat names. 139 * Case insensitive compare of two vfat names.
140 */ 140 */
141static int vfat_cmpi(const struct dentry *parent, const struct dentry *dentry, 141static int vfat_cmpi(const struct dentry *dentry,
142 unsigned int len, const char *str, const struct qstr *name) 142 unsigned int len, const char *str, const struct qstr *name)
143{ 143{
144 struct nls_table *t = MSDOS_SB(parent->d_sb)->nls_io; 144 struct nls_table *t = MSDOS_SB(dentry->d_sb)->nls_io;
145 unsigned int alen, blen; 145 unsigned int alen, blen;
146 146
147 /* A filename cannot end in '.' or we treat it like it has none */ 147 /* A filename cannot end in '.' or we treat it like it has none */
@@ -157,7 +157,7 @@ static int vfat_cmpi(const struct dentry *parent, const struct dentry *dentry,
157/* 157/*
158 * Case sensitive compare of two vfat names. 158 * Case sensitive compare of two vfat names.
159 */ 159 */
160static int vfat_cmp(const struct dentry *parent, const struct dentry *dentry, 160static int vfat_cmp(const struct dentry *dentry,
161 unsigned int len, const char *str, const struct qstr *name) 161 unsigned int len, const char *str, const struct qstr *name)
162{ 162{
163 unsigned int alen, blen; 163 unsigned int alen, blen;
diff --git a/fs/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h
index e799ebe71b51..16f5172ee40d 100644
--- a/fs/hfs/hfs_fs.h
+++ b/fs/hfs/hfs_fs.h
@@ -233,7 +233,7 @@ extern const struct dentry_operations hfs_dentry_operations;
233extern int hfs_hash_dentry(const struct dentry *, struct qstr *); 233extern int hfs_hash_dentry(const struct dentry *, struct qstr *);
234extern int hfs_strcmp(const unsigned char *, unsigned int, 234extern int hfs_strcmp(const unsigned char *, unsigned int,
235 const unsigned char *, unsigned int); 235 const unsigned char *, unsigned int);
236extern int hfs_compare_dentry(const struct dentry *parent, const struct dentry *dentry, 236extern int hfs_compare_dentry(const struct dentry *dentry,
237 unsigned int len, const char *str, const struct qstr *name); 237 unsigned int len, const char *str, const struct qstr *name);
238 238
239/* trans.c */ 239/* trans.c */
diff --git a/fs/hfs/string.c b/fs/hfs/string.c
index ec9f164c35a5..3912209153a8 100644
--- a/fs/hfs/string.c
+++ b/fs/hfs/string.c
@@ -92,7 +92,7 @@ int hfs_strcmp(const unsigned char *s1, unsigned int len1,
92 * Test for equality of two strings in the HFS filename character ordering. 92 * Test for equality of two strings in the HFS filename character ordering.
93 * return 1 on failure and 0 on success 93 * return 1 on failure and 0 on success
94 */ 94 */
95int hfs_compare_dentry(const struct dentry *parent, const struct dentry *dentry, 95int hfs_compare_dentry(const struct dentry *dentry,
96 unsigned int len, const char *str, const struct qstr *name) 96 unsigned int len, const char *str, const struct qstr *name)
97{ 97{
98 const unsigned char *n1, *n2; 98 const unsigned char *n1, *n2;
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h
index 47e009666abd..a3f03b247463 100644
--- a/fs/hfsplus/hfsplus_fs.h
+++ b/fs/hfsplus/hfsplus_fs.h
@@ -520,8 +520,7 @@ int hfsplus_uni2asc(struct super_block *sb, const struct hfsplus_unistr *ustr,
520int hfsplus_asc2uni(struct super_block *sb, struct hfsplus_unistr *ustr, 520int hfsplus_asc2uni(struct super_block *sb, struct hfsplus_unistr *ustr,
521 int max_unistr_len, const char *astr, int len); 521 int max_unistr_len, const char *astr, int len);
522int hfsplus_hash_dentry(const struct dentry *dentry, struct qstr *str); 522int hfsplus_hash_dentry(const struct dentry *dentry, struct qstr *str);
523int hfsplus_compare_dentry(const struct dentry *parent, 523int hfsplus_compare_dentry(const struct dentry *dentry, unsigned int len,
524 const struct dentry *dentry, unsigned int len,
525 const char *str, const struct qstr *name); 524 const char *str, const struct qstr *name);
526 525
527/* wrapper.c */ 526/* wrapper.c */
diff --git a/fs/hfsplus/unicode.c b/fs/hfsplus/unicode.c
index c13c8a240be3..e563939882f3 100644
--- a/fs/hfsplus/unicode.c
+++ b/fs/hfsplus/unicode.c
@@ -385,10 +385,10 @@ int hfsplus_hash_dentry(const struct dentry *dentry, struct qstr *str)
385 * Composed unicode characters are decomposed and case-folding is performed 385 * Composed unicode characters are decomposed and case-folding is performed
386 * if the appropriate bits are (un)set on the superblock. 386 * if the appropriate bits are (un)set on the superblock.
387 */ 387 */
388int hfsplus_compare_dentry(const struct dentry *parent, const struct dentry *dentry, 388int hfsplus_compare_dentry(const struct dentry *dentry,
389 unsigned int len, const char *str, const struct qstr *name) 389 unsigned int len, const char *str, const struct qstr *name)
390{ 390{
391 struct super_block *sb = parent->d_sb; 391 struct super_block *sb = dentry->d_sb;
392 int casefold, decompose, size; 392 int casefold, decompose, size;
393 int dsize1, dsize2, len1, len2; 393 int dsize1, dsize2, len1, len2;
394 const u16 *dstr1, *dstr2; 394 const u16 *dstr1, *dstr2;
diff --git a/fs/hpfs/dentry.c b/fs/hpfs/dentry.c
index 60e6d334d79a..bb87d65f0d97 100644
--- a/fs/hpfs/dentry.c
+++ b/fs/hpfs/dentry.c
@@ -34,7 +34,7 @@ static int hpfs_hash_dentry(const struct dentry *dentry, struct qstr *qstr)
34 return 0; 34 return 0;
35} 35}
36 36
37static int hpfs_compare_dentry(const struct dentry *parent, const struct dentry *dentry, 37static int hpfs_compare_dentry(const struct dentry *dentry,
38 unsigned int len, const char *str, const struct qstr *name) 38 unsigned int len, const char *str, const struct qstr *name)
39{ 39{
40 unsigned al = len; 40 unsigned al = len;
@@ -50,7 +50,7 @@ static int hpfs_compare_dentry(const struct dentry *parent, const struct dentry
50 50
51 if (hpfs_chk_name(name->name, &bl)) 51 if (hpfs_chk_name(name->name, &bl))
52 return 1; 52 return 1;
53 if (hpfs_compare_names(parent->d_sb, str, al, name->name, bl, 0)) 53 if (hpfs_compare_names(dentry->d_sb, str, al, name->name, bl, 0))
54 return 1; 54 return 1;
55 return 0; 55 return 0;
56} 56}
diff --git a/fs/inode.c b/fs/inode.c
index ad445542c285..7e3ef3af3db9 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1729,7 +1729,6 @@ int dentry_needs_remove_privs(struct dentry *dentry)
1729 mask |= ATTR_KILL_PRIV; 1729 mask |= ATTR_KILL_PRIV;
1730 return mask; 1730 return mask;
1731} 1731}
1732EXPORT_SYMBOL(dentry_needs_remove_privs);
1733 1732
1734static int __remove_privs(struct dentry *dentry, int kill) 1733static int __remove_privs(struct dentry *dentry, int kill)
1735{ 1734{
@@ -1749,8 +1748,8 @@ static int __remove_privs(struct dentry *dentry, int kill)
1749 */ 1748 */
1750int file_remove_privs(struct file *file) 1749int file_remove_privs(struct file *file)
1751{ 1750{
1752 struct dentry *dentry = file->f_path.dentry; 1751 struct dentry *dentry = file_dentry(file);
1753 struct inode *inode = d_inode(dentry); 1752 struct inode *inode = file_inode(file);
1754 int kill; 1753 int kill;
1755 int error = 0; 1754 int error = 0;
1756 1755
@@ -1758,7 +1757,7 @@ int file_remove_privs(struct file *file)
1758 if (IS_NOSEC(inode)) 1757 if (IS_NOSEC(inode))
1759 return 0; 1758 return 0;
1760 1759
1761 kill = file_needs_remove_privs(file); 1760 kill = dentry_needs_remove_privs(dentry);
1762 if (kill < 0) 1761 if (kill < 0)
1763 return kill; 1762 return kill;
1764 if (kill) 1763 if (kill)
diff --git a/fs/internal.h b/fs/internal.h
index cef0913e5d41..cc5a530e4f06 100644
--- a/fs/internal.h
+++ b/fs/internal.h
@@ -117,6 +117,7 @@ extern int vfs_open(const struct path *, struct file *, const struct cred *);
117 */ 117 */
118extern long prune_icache_sb(struct super_block *sb, struct shrink_control *sc); 118extern long prune_icache_sb(struct super_block *sb, struct shrink_control *sc);
119extern void inode_add_lru(struct inode *inode); 119extern void inode_add_lru(struct inode *inode);
120extern int dentry_needs_remove_privs(struct dentry *dentry);
120 121
121/* 122/*
122 * fs-writeback.c 123 * fs-writeback.c
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 761fade7680f..ad0c745ebad7 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -29,18 +29,15 @@
29#define BEQUIET 29#define BEQUIET
30 30
31static int isofs_hashi(const struct dentry *parent, struct qstr *qstr); 31static int isofs_hashi(const struct dentry *parent, struct qstr *qstr);
32static int isofs_dentry_cmpi(const struct dentry *parent, 32static int isofs_dentry_cmpi(const struct dentry *dentry,
33 const struct dentry *dentry,
34 unsigned int len, const char *str, const struct qstr *name); 33 unsigned int len, const char *str, const struct qstr *name);
35 34
36#ifdef CONFIG_JOLIET 35#ifdef CONFIG_JOLIET
37static int isofs_hashi_ms(const struct dentry *parent, struct qstr *qstr); 36static int isofs_hashi_ms(const struct dentry *parent, struct qstr *qstr);
38static int isofs_hash_ms(const struct dentry *parent, struct qstr *qstr); 37static int isofs_hash_ms(const struct dentry *parent, struct qstr *qstr);
39static int isofs_dentry_cmpi_ms(const struct dentry *parent, 38static int isofs_dentry_cmpi_ms(const struct dentry *dentry,
40 const struct dentry *dentry,
41 unsigned int len, const char *str, const struct qstr *name); 39 unsigned int len, const char *str, const struct qstr *name);
42static int isofs_dentry_cmp_ms(const struct dentry *parent, 40static int isofs_dentry_cmp_ms(const struct dentry *dentry,
43 const struct dentry *dentry,
44 unsigned int len, const char *str, const struct qstr *name); 41 unsigned int len, const char *str, const struct qstr *name);
45#endif 42#endif
46 43
@@ -235,7 +232,7 @@ isofs_hashi(const struct dentry *dentry, struct qstr *qstr)
235} 232}
236 233
237static int 234static int
238isofs_dentry_cmpi(const struct dentry *parent, const struct dentry *dentry, 235isofs_dentry_cmpi(const struct dentry *dentry,
239 unsigned int len, const char *str, const struct qstr *name) 236 unsigned int len, const char *str, const struct qstr *name)
240{ 237{
241 return isofs_dentry_cmp_common(len, str, name, 0, 1); 238 return isofs_dentry_cmp_common(len, str, name, 0, 1);
@@ -276,14 +273,14 @@ isofs_hashi_ms(const struct dentry *dentry, struct qstr *qstr)
276} 273}
277 274
278static int 275static int
279isofs_dentry_cmp_ms(const struct dentry *parent, const struct dentry *dentry, 276isofs_dentry_cmp_ms(const struct dentry *dentry,
280 unsigned int len, const char *str, const struct qstr *name) 277 unsigned int len, const char *str, const struct qstr *name)
281{ 278{
282 return isofs_dentry_cmp_common(len, str, name, 1, 0); 279 return isofs_dentry_cmp_common(len, str, name, 1, 0);
283} 280}
284 281
285static int 282static int
286isofs_dentry_cmpi_ms(const struct dentry *parent, const struct dentry *dentry, 283isofs_dentry_cmpi_ms(const struct dentry *dentry,
287 unsigned int len, const char *str, const struct qstr *name) 284 unsigned int len, const char *str, const struct qstr *name)
288{ 285{
289 return isofs_dentry_cmp_common(len, str, name, 1, 1); 286 return isofs_dentry_cmp_common(len, str, name, 1, 1);
diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c
index 7b543e6b6526..aee592767f1d 100644
--- a/fs/isofs/namei.c
+++ b/fs/isofs/namei.c
@@ -22,7 +22,7 @@ isofs_cmp(struct dentry *dentry, const char *compare, int dlen)
22 qstr.len = dlen; 22 qstr.len = dlen;
23 if (likely(!dentry->d_op)) 23 if (likely(!dentry->d_op))
24 return dentry->d_name.len != dlen || memcmp(dentry->d_name.name, compare, dlen); 24 return dentry->d_name.len != dlen || memcmp(dentry->d_name.name, compare, dlen);
25 return dentry->d_op->d_compare(NULL, NULL, dentry->d_name.len, dentry->d_name.name, &qstr); 25 return dentry->d_op->d_compare(NULL, dentry->d_name.len, dentry->d_name.name, &qstr);
26} 26}
27 27
28/* 28/*
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index 04baf0dfc40c..814b0c58016c 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -1572,7 +1572,7 @@ static int jfs_ci_hash(const struct dentry *dir, struct qstr *this)
1572 return 0; 1572 return 0;
1573} 1573}
1574 1574
1575static int jfs_ci_compare(const struct dentry *parent, const struct dentry *dentry, 1575static int jfs_ci_compare(const struct dentry *dentry,
1576 unsigned int len, const char *str, const struct qstr *name) 1576 unsigned int len, const char *str, const struct qstr *name)
1577{ 1577{
1578 int i, result = 1; 1578 int i, result = 1;
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c
index 9add7ab747a5..17de5c13dfae 100644
--- a/fs/ncpfs/dir.c
+++ b/fs/ncpfs/dir.c
@@ -74,7 +74,7 @@ const struct inode_operations ncp_dir_inode_operations =
74 */ 74 */
75static int ncp_lookup_validate(struct dentry *, unsigned int); 75static int ncp_lookup_validate(struct dentry *, unsigned int);
76static int ncp_hash_dentry(const struct dentry *, struct qstr *); 76static int ncp_hash_dentry(const struct dentry *, struct qstr *);
77static int ncp_compare_dentry(const struct dentry *, const struct dentry *, 77static int ncp_compare_dentry(const struct dentry *,
78 unsigned int, const char *, const struct qstr *); 78 unsigned int, const char *, const struct qstr *);
79static int ncp_delete_dentry(const struct dentry *); 79static int ncp_delete_dentry(const struct dentry *);
80static void ncp_d_prune(struct dentry *dentry); 80static void ncp_d_prune(struct dentry *dentry);
@@ -154,7 +154,7 @@ ncp_hash_dentry(const struct dentry *dentry, struct qstr *this)
154 * the callers will handle races. 154 * the callers will handle races.
155 */ 155 */
156static int 156static int
157ncp_compare_dentry(const struct dentry *parent, const struct dentry *dentry, 157ncp_compare_dentry(const struct dentry *dentry,
158 unsigned int len, const char *str, const struct qstr *name) 158 unsigned int len, const char *str, const struct qstr *name)
159{ 159{
160 struct inode *pinode; 160 struct inode *pinode;
@@ -162,7 +162,7 @@ ncp_compare_dentry(const struct dentry *parent, const struct dentry *dentry,
162 if (len != name->len) 162 if (len != name->len)
163 return 1; 163 return 1;
164 164
165 pinode = d_inode_rcu(parent); 165 pinode = d_inode_rcu(dentry->d_parent);
166 if (!pinode) 166 if (!pinode)
167 return 1; 167 return 1;
168 168
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index ffbb513c06c6..1b93650dda2f 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -834,7 +834,7 @@ static int sysctl_is_seen(struct ctl_table_header *p)
834 return res; 834 return res;
835} 835}
836 836
837static int proc_sys_compare(const struct dentry *parent, const struct dentry *dentry, 837static int proc_sys_compare(const struct dentry *dentry,
838 unsigned int len, const char *str, const struct qstr *name) 838 unsigned int len, const char *str, const struct qstr *name)
839{ 839{
840 struct ctl_table_header *head; 840 struct ctl_table_header *head;
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index accfa1ef072a..5ff3e9a4fe5f 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -130,7 +130,7 @@ struct dentry_operations {
130 int (*d_revalidate)(struct dentry *, unsigned int); 130 int (*d_revalidate)(struct dentry *, unsigned int);
131 int (*d_weak_revalidate)(struct dentry *, unsigned int); 131 int (*d_weak_revalidate)(struct dentry *, unsigned int);
132 int (*d_hash)(const struct dentry *, struct qstr *); 132 int (*d_hash)(const struct dentry *, struct qstr *);
133 int (*d_compare)(const struct dentry *, const struct dentry *, 133 int (*d_compare)(const struct dentry *,
134 unsigned int, const char *, const struct qstr *); 134 unsigned int, const char *, const struct qstr *);
135 int (*d_delete)(const struct dentry *); 135 int (*d_delete)(const struct dentry *);
136 int (*d_init)(struct dentry *); 136 int (*d_init)(struct dentry *);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 498255e6914e..33f0e96db06f 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2748,11 +2748,6 @@ extern struct inode *new_inode(struct super_block *sb);
2748extern void free_inode_nonrcu(struct inode *inode); 2748extern void free_inode_nonrcu(struct inode *inode);
2749extern int should_remove_suid(struct dentry *); 2749extern int should_remove_suid(struct dentry *);
2750extern int file_remove_privs(struct file *); 2750extern int file_remove_privs(struct file *);
2751extern int dentry_needs_remove_privs(struct dentry *dentry);
2752static inline int file_needs_remove_privs(struct file *file)
2753{
2754 return dentry_needs_remove_privs(file->f_path.dentry);
2755}
2756 2751
2757extern void __insert_inode_hash(struct inode *, unsigned long hashval); 2752extern void __insert_inode_hash(struct inode *, unsigned long hashval);
2758static inline void insert_inode_hash(struct inode *inode) 2753static inline void insert_inode_hash(struct inode *inode)