[PATCH] 9p: fix fid behavior on failed remove
authorEric Van Hensbergen <ericvh@hera.kernel.org>
Sun, 30 Jul 2006 10:04:16 +0000 (03:04 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 31 Jul 2006 20:28:44 +0000 (13:28 -0700)
Based on a bug report from Russ Ross <russruss@gmail.com>

According to the spec:

"The remove request asks the file server both to remove the file
 represented by fid and to clunk the fid, even if the remove fails."

but the Linux client seems to expect the fid to be valid after a failed
remove attempt.  Specifically, I'm getting this behavior when attempting to
remove a non-empty directory.

Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/9p/vfs_inode.c

index 2f580a197b8dadf573ce7093742e4e647c950c82..eae50c9d6dc41f0ca06524357008775a59d74fe1 100644 (file)
@@ -434,11 +434,11 @@ static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir)
        result = v9fs_t_remove(v9ses, fid, &fcall);
        if (result < 0) {
                PRINT_FCALL_ERROR("remove fails", fcall);
-       } else {
-               v9fs_put_idpool(fid, &v9ses->fidpool);
-               v9fs_fid_destroy(v9fid);
        }
 
+       v9fs_put_idpool(fid, &v9ses->fidpool);
+       v9fs_fid_destroy(v9fid);
+
        kfree(fcall);
        return result;
 }