]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - fs/nfsd/state.h
nfsd4: fix downgrade/lock logic
[net-next-2.6.git] / fs / nfsd / state.h
index 84579c86b13dba5338bced8843fb6c316470ec10..322518c88e4b09eee40473ed8efaece99e02410b 100644 (file)
@@ -363,16 +363,16 @@ struct nfs4_file {
  * at all? */
 static inline struct file *find_writeable_file(struct nfs4_file *f)
 {
-       if (f->fi_fds[O_RDWR])
-               return f->fi_fds[O_RDWR];
-       return f->fi_fds[O_WRONLY];
+       if (f->fi_fds[O_WRONLY])
+               return f->fi_fds[O_WRONLY];
+       return f->fi_fds[O_RDWR];
 }
 
 static inline struct file *find_readable_file(struct nfs4_file *f)
 {
-       if (f->fi_fds[O_RDWR])
-               return f->fi_fds[O_RDWR];
-       return f->fi_fds[O_RDONLY];
+       if (f->fi_fds[O_RDONLY])
+               return f->fi_fds[O_RDONLY];
+       return f->fi_fds[O_RDWR];
 }
 
 static inline struct file *find_any_file(struct nfs4_file *f)