Skip to content

Commit fe64f32

Browse files
committed
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
2 parents 0cbbc42 + db20a89 commit fe64f32

File tree

32 files changed

+82
-130
lines changed

32 files changed

+82
-130
lines changed

Documentation/filesystems/Locking

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ prototypes:
1212
int (*d_revalidate)(struct dentry *, unsigned int);
1313
int (*d_weak_revalidate)(struct dentry *, unsigned int);
1414
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 *,
1616
unsigned int, const char *, const struct qstr *);
1717
int (*d_delete)(struct dentry *);
1818
int (*d_init)(struct dentry *);

Documentation/filesystems/porting

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,3 +585,10 @@ in your dentry operations instead.
585585
in the instances. Rationale: !@#!@# security_d_instantiate() needs to be
586586
called before we attach dentry to inode and !@#!@##!@$!$#!@#$!@$!@$ smack
587587
->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.

Documentation/filesystems/vfs.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ struct dentry_operations {
931931
int (*d_revalidate)(struct dentry *, unsigned int);
932932
int (*d_weak_revalidate)(struct dentry *, unsigned int);
933933
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 *,
935935
unsigned int, const char *, const struct qstr *);
936936
int (*d_delete)(const struct dentry *);
937937
int (*d_init)(struct dentry *);

drivers/staging/lustre/lustre/llite/dcache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static void ll_release(struct dentry *de)
7878
* INVALID) so d_lookup() matches it, but we have no lock on it (so
7979
* lock_match() fails) and we spin around real_lookup().
8080
*/
81-
static int ll_dcompare(const struct dentry *parent, const struct dentry *dentry,
81+
static int ll_dcompare(const struct dentry *dentry,
8282
unsigned int len, const char *str,
8383
const struct qstr *name)
8484
{

fs/9p/fid.c

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -257,36 +257,12 @@ struct p9_fid *v9fs_fid_lookup(struct dentry *dentry)
257257
return v9fs_fid_lookup_with_uid(dentry, uid, any);
258258
}
259259

260-
struct 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-
272-
static 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-
284260
struct p9_fid *v9fs_writeback_fid(struct dentry *dentry)
285261
{
286262
int err;
287263
struct p9_fid *fid;
288264

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));
290266
if (IS_ERR(fid))
291267
goto error_out;
292268
/*

fs/9p/fid.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,14 @@ static inline struct p9_fid *v9fs_parent_fid(struct dentry *dentry)
2828
{
2929
return v9fs_fid_lookup(dentry->d_parent);
3030
}
31-
struct p9_fid *v9fs_fid_clone(struct dentry *dentry);
3231
void v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid);
3332
struct p9_fid *v9fs_writeback_fid(struct dentry *dentry);
33+
static 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+
}
37+
static inline struct p9_fid *v9fs_fid_clone(struct dentry *dentry)
38+
{
39+
return clone_fid(v9fs_fid_lookup(dentry));
40+
}
3441
#endif

fs/9p/vfs_inode.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
661661
}
662662

663663
/* clone a fid to use for creation */
664-
ofid = p9_client_walk(dfid, 0, NULL, 1);
664+
ofid = clone_fid(dfid);
665665
if (IS_ERR(ofid)) {
666666
err = PTR_ERR(ofid);
667667
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,
975975
if (IS_ERR(oldfid))
976976
return PTR_ERR(oldfid);
977977

978-
olddirfid = v9fs_parent_fid(old_dentry);
978+
olddirfid = clone_fid(v9fs_parent_fid(old_dentry));
979979
if (IS_ERR(olddirfid)) {
980980
retval = PTR_ERR(olddirfid);
981981
goto done;
982982
}
983983

984-
newdirfid = v9fs_parent_fid(new_dentry);
984+
newdirfid = clone_fid(v9fs_parent_fid(new_dentry));
985985
if (IS_ERR(newdirfid)) {
986986
retval = PTR_ERR(newdirfid);
987987
goto clunk_olddir;

fs/9p/vfs_inode_dotl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
281281
}
282282

283283
/* clone a fid to use for creation */
284-
ofid = p9_client_walk(dfid, 0, NULL, 1);
284+
ofid = clone_fid(dfid);
285285
if (IS_ERR(ofid)) {
286286
err = PTR_ERR(ofid);
287287
p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);

fs/9p/xattr.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ int v9fs_xattr_set(struct dentry *dentry, const char *name,
9797
const void *value, size_t value_len, int flags)
9898
{
9999
struct p9_fid *fid = v9fs_fid_lookup(dentry);
100-
if (IS_ERR(fid))
101-
return PTR_ERR(fid);
102100
return v9fs_fid_xattr_set(fid, name, value, value_len, flags);
103101
}
104102

@@ -115,7 +113,7 @@ int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name,
115113
name, value_len, flags);
116114

117115
/* Clone it */
118-
fid = p9_client_walk(fid, 0, NULL, 1);
116+
fid = clone_fid(fid);
119117
if (IS_ERR(fid))
120118
return PTR_ERR(fid);
121119

fs/adfs/dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ adfs_hash(const struct dentry *parent, struct qstr *qstr)
227227
* requirements of the underlying filesystem.
228228
*/
229229
static int
230-
adfs_compare(const struct dentry *parent, const struct dentry *dentry,
230+
adfs_compare(const struct dentry *dentry,
231231
unsigned int len, const char *str, const struct qstr *name)
232232
{
233233
int i;

0 commit comments

Comments
 (0)