From patchwork Mon Jul 23 19:49:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 1228721 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id DF7C23FD4F for ; Mon, 23 Jul 2012 19:50:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754695Ab2GWTuG (ORCPT ); Mon, 23 Jul 2012 15:50:06 -0400 Received: from mail-yx0-f174.google.com ([209.85.213.174]:45230 "EHLO mail-yx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754661Ab2GWTuE (ORCPT ); Mon, 23 Jul 2012 15:50:04 -0400 Received: by yenl2 with SMTP id l2so5885784yen.19 for ; Mon, 23 Jul 2012 12:50:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=gL8pusW5VEqQbhJ/bAHnIoqR4zd368dMKXjHB4SMsno=; b=jAkMEz5vaOTOlarcSldPZTrYvwX8+VbbYNV818fjkFzkSRfoU+YEp8pH3czB5EC144 2WVQApskDWakAt+fISDeXGIf4fTGdrrbybtMxunKNmzBOFJp4L2N8bOastpUCZoVpmvA TKEErMz/z6QcSYfxHnuKPdXgaBAtmv2hphSudX8Neb9CO5fgDAK0IkgJZQkk8m4Obmp4 M5UShPMQ9jzRvtYhcrB2+rylxSpaxI8jI2tDkgidiNn+icjXtEbhBNZqIFpjxxD/kxMQ yQJyR9dNv9p5yoB4rr2Pf4X/tkLbmNDPyeHPgAwmyJ4/F9O3oNFIm29DBaeB5FB3vtTb WI1w== Received: by 10.236.73.4 with SMTP id u4mr15025504yhd.78.1343073004060; Mon, 23 Jul 2012 12:50:04 -0700 (PDT) Received: from salusa.poochiereds.net (cpe-076-182-054-194.nc.res.rr.com. [76.182.54.194]) by mx.google.com with ESMTPS id i65sm26685955yhb.3.2012.07.23.12.50.03 (version=SSLv3 cipher=OTHER); Mon, 23 Jul 2012 12:50:03 -0700 (PDT) From: Jeff Layton To: trond.myklebust@netapp.com Cc: viro@ZenIV.linux.org.uk, linux-nfs@vger.kernel.org Subject: [PATCH] nfs: fix fl_type tests in NFSv4 code Date: Mon, 23 Jul 2012 15:49:56 -0400 Message-Id: <1343072996-29852-1-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.10.4 X-Gm-Message-State: ALoCoQnR7EqhDGMkhd+31bWQRF7yPTg08KpizNguXDA/EPAZIxc1juJ93dp9FmEcXsE5uuGwa7tZ Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org fl_type is not a bitmap. Reported-by: Al Viro Signed-off-by: Jeff Layton --- fs/nfs/nfs4proc.c | 2 +- fs/nfs/nfs4xdr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 15fc7e4..32b3048 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -4824,7 +4824,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; diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 18fae29..b3199c7 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -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; }