9p: fix braino introduced in "9p: new helper - v9fs_parent_fid()"
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 3 Aug 2016 15:02:48 +0000 (11:02 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 3 Aug 2016 15:02:48 +0000 (11:02 -0400)
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>
fs/9p/fid.h
fs/9p/vfs_inode.c

index 12700df0bb513c53290baef5ae9eb5aa6cb0abfd..d4c5002d56ad77a15a32be975b7a60f9acbe40a9 100644 (file)
@@ -31,4 +31,8 @@ static inline struct p9_fid *v9fs_parent_fid(struct dentry *dentry)
 struct p9_fid *v9fs_fid_clone(struct dentry *dentry);
 void v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid);
 struct p9_fid *v9fs_writeback_fid(struct dentry *dentry);
+static inline struct p9_fid *clone_fid(struct p9_fid *fid)
+{
+       return IS_ERR(fid) ? fid :  p9_client_walk(fid, 0, NULL, 1);
+}
 #endif
index 7da9a8354fad475adf68393fbd2edfce7e620b61..26189eebcd1c072f7b6bb2203874e412d6e4d3df 100644 (file)
@@ -975,13 +975,13 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
        if (IS_ERR(oldfid))
                return PTR_ERR(oldfid);
 
-       olddirfid = v9fs_parent_fid(old_dentry);
+       olddirfid = clone_fid(v9fs_parent_fid(old_dentry));
        if (IS_ERR(olddirfid)) {
                retval = PTR_ERR(olddirfid);
                goto done;
        }
 
-       newdirfid = v9fs_parent_fid(new_dentry);
+       newdirfid = clone_fid(v9fs_parent_fid(new_dentry));
        if (IS_ERR(newdirfid)) {
                retval = PTR_ERR(newdirfid);
                goto clunk_olddir;
This page took 0.029731 seconds and 5 git commands to generate.