Commit f44106e2 authored by Jeff Layton's avatar Jeff Layton Committed by Trond Myklebust

nfs: fix fl_type tests in NFSv4 code

fl_type is not a bitmap.
Reported-by: default avatarAl Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent c95908e4
...@@ -4885,7 +4885,7 @@ nfs4_proc_lock(struct file *filp, int cmd, struct file_lock *request) ...@@ -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, * Don't rely on the VFS having checked the file open mode,
* since it won't do this for flock() locks. * 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: case F_RDLCK:
if (!(filp->f_mode & FMODE_READ)) if (!(filp->f_mode & FMODE_READ))
return -EBADF; return -EBADF;
......
...@@ -1236,7 +1236,7 @@ static void encode_link(struct xdr_stream *xdr, const struct qstr *name, struct ...@@ -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) 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_READW_LT : NFS4_READ_LT;
return block ? NFS4_WRITEW_LT : NFS4_WRITE_LT; return block ? NFS4_WRITEW_LT : NFS4_WRITE_LT;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment