aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-08-03 11:02:48 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2016-08-03 11:02:48 -0400
commit797fc16d8f00bf681b7f9969c0701725b472b11a (patch)
tree086e31f304992724b5e92eac90688601d29d7134 /fs
parent6fa67e707559303e086303aeecc9e8b91ef497d5 (diff)
9p: fix braino introduced in "9p: new helper - v9fs_parent_fid()"
In v9fs_vfs_rename() we need to clone the parents' fids, not just find them. Spotted-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/9p/fid.h4
-rw-r--r--fs/9p/vfs_inode.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/fs/9p/fid.h b/fs/9p/fid.h
index 12700df0bb51..d4c5002d56ad 100644
--- a/fs/9p/fid.h
+++ b/fs/9p/fid.h
@@ -31,4 +31,8 @@ static inline struct p9_fid *v9fs_parent_fid(struct dentry *dentry)
31struct p9_fid *v9fs_fid_clone(struct dentry *dentry); 31struct p9_fid *v9fs_fid_clone(struct dentry *dentry);
32void v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid); 32void v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid);
33struct p9_fid *v9fs_writeback_fid(struct dentry *dentry); 33struct p9_fid *v9fs_writeback_fid(struct dentry *dentry);
34static inline struct p9_fid *clone_fid(struct p9_fid *fid)
35{
36 return IS_ERR(fid) ? fid : p9_client_walk(fid, 0, NULL, 1);
37}
34#endif 38#endif
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 7da9a8354fad..26189eebcd1c 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -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;