nfs: fix fl_type tests in NFSv4 code
authorJeff Layton <jlayton@redhat.com>
Mon, 23 Jul 2012 19:49:56 +0000 (15:49 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Mon, 30 Jul 2012 22:09:13 +0000 (18:09 -0400)
fl_type is not a bitmap.

Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/nfs4proc.c
fs/nfs/nfs4xdr.c

index 5e373c30e8d42cdcb534dc981ce350e001e4b19e..6843e0a37de8eb900421ae118d76c889afe041ef 100644 (file)
@@ -4885,7 +4885,7 @@ nfs4_proc_lock(struct file *filp, int cmd, struct file_lock *request)
         * Don't rely on the VFS having checked the file open mode,
         * since it won't do this for flock() locks.
         */
-       switch (request->fl_type & (F_RDLCK|F_WRLCK|F_UNLCK)) {
+       switch (request->fl_type) {
        case F_RDLCK:
                if (!(filp->f_mode & FMODE_READ))
                        return -EBADF;
index 610ebccbde5d6769389a2c239cc212035925f298..6cbd602e26d5c1c04b809143d1600914564881a6 100644 (file)
@@ -1236,7 +1236,7 @@ static void encode_link(struct xdr_stream *xdr, const struct qstr *name, struct
 
 static inline int nfs4_lock_type(struct file_lock *fl, int block)
 {
-       if ((fl->fl_type & (F_RDLCK|F_WRLCK|F_UNLCK)) == F_RDLCK)
+       if (fl->fl_type == F_RDLCK)
                return block ? NFS4_READW_LT : NFS4_READ_LT;
        return block ? NFS4_WRITEW_LT : NFS4_WRITE_LT;
 }