ocfs2: combine inode and generic blocking AST functions
[sfrench/cifs-2.6.git] / fs / 9p / vfs_file.c
index 083dcfcd158e1cd3df4e445fdecabdd3c286f8eb..c3c47eda7574fc24a6cbb33e4730a16140c1c988 100644 (file)
@@ -31,7 +31,6 @@
 #include <linux/string.h>
 #include <linux/smp_lock.h>
 #include <linux/inet.h>
-#include <linux/version.h>
 #include <linux/list.h>
 #include <asm/uaccess.h>
 #include <linux/idr.h>
@@ -72,11 +71,17 @@ int v9fs_file_open(struct inode *inode, struct file *file)
                return -ENOSPC;
        }
 
-       err = v9fs_t_walk(v9ses, vfid->fid, fid, NULL, NULL);
+       err = v9fs_t_walk(v9ses, vfid->fid, fid, NULL, &fcall);
        if (err < 0) {
                dprintk(DEBUG_ERROR, "rewalk didn't work\n");
-               goto put_fid;
+               if (fcall && fcall->id == RWALK)
+                       goto clunk_fid;
+               else {
+                       v9fs_put_idpool(fid, &v9ses->fidpool);
+                       goto free_fcall;
+               }
        }
+       kfree(fcall);
 
        /* TODO: do special things for O_EXCL, O_NOFOLLOW, O_SYNC */
        /* translate open mode appropriately */
@@ -109,8 +114,7 @@ int v9fs_file_open(struct inode *inode, struct file *file)
 clunk_fid:
        v9fs_t_clunk(v9ses, fid);
 
-put_fid:
-       v9fs_put_idpool(fid, &v9ses->fidpool);
+free_fcall:
        kfree(fcall);
 
        return err;