fs/9p: Attach writeback_fid on first open with WR flag
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Tue, 8 Mar 2011 11:09:49 +0000 (16:39 +0530)
committerEric Van Hensbergen <ericvh@gmail.com>
Tue, 22 Mar 2011 20:43:36 +0000 (15:43 -0500)
We don't need writeback fid if we are only doing O_RDONLY open

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
fs/9p/vfs_file.c
fs/9p/vfs_inode.c
fs/9p/vfs_inode_dotl.c

index 3337d58d0fc5883a0a6c19c2352cf3e639cbb86a..6997eb62fbba264827f34f1a2b1299f6c4ba43ab 100644 (file)
@@ -91,7 +91,8 @@ int v9fs_file_open(struct inode *inode, struct file *file)
 
        file->private_data = fid;
        mutex_lock(&v9inode->v_mutex);
-       if (v9ses->cache && !v9inode->writeback_fid) {
+       if (v9ses->cache && !v9inode->writeback_fid &&
+           ((file->f_flags & O_ACCMODE) != O_RDONLY)) {
                /*
                 * clone a fid and add it to writeback_fid
                 * we do it during open time instead of
index 0afbbb450faf8a9892b4cc88e484df4296c0ff9c..774a20af01ead226d3487611e93aa08fd4f37f19 100644 (file)
@@ -652,7 +652,8 @@ v9fs_vfs_create(struct inode *dir, struct dentry *dentry, int mode,
        if (nd && nd->flags & LOOKUP_OPEN) {
                v9inode = V9FS_I(dentry->d_inode);
                mutex_lock(&v9inode->v_mutex);
-               if (v9ses->cache && !v9inode->writeback_fid) {
+               if (v9ses->cache && !v9inode->writeback_fid &&
+                   ((flags & O_ACCMODE) != O_RDONLY)) {
                        /*
                         * clone a fid and add it to writeback_fid
                         * we do it during open time instead of
index 0a0ac30d51d6d898d7b4b0181f2f03c2ed057567..8b616dc3567a26d6585679925583ec7c1da70dfe 100644 (file)
@@ -246,7 +246,8 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
 
        v9inode = V9FS_I(inode);
        mutex_lock(&v9inode->v_mutex);
-       if (v9ses->cache && !v9inode->writeback_fid) {
+       if (v9ses->cache && !v9inode->writeback_fid &&
+           ((flags & O_ACCMODE) != O_RDONLY)) {
                /*
                 * clone a fid and add it to writeback_fid
                 * we do it during open time instead of