NFS: Fix the mode calculation in nfs_find_open_context
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Thu, 25 Mar 2010 17:54:49 +0000 (13:54 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 9 Apr 2010 23:08:16 +0000 (19:08 -0400)
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/inode.c

index 737128f777f366190a1e82aa1371ee8d75d5fe8d..50a56edca0b572fc7bd274ab809f3df7b4f4d031 100644 (file)
@@ -623,10 +623,10 @@ struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_c
        list_for_each_entry(pos, &nfsi->open_files, list) {
                if (cred != NULL && pos->cred != cred)
                        continue;
-               if ((pos->mode & mode) == mode) {
-                       ctx = get_nfs_open_context(pos);
-                       break;
-               }
+               if ((pos->mode & (FMODE_READ|FMODE_WRITE)) != mode)
+                       continue;
+               ctx = get_nfs_open_context(pos);
+               break;
        }
        spin_unlock(&inode->i_lock);
        return ctx;