From patchwork Fri Aug 30 21:30:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J. Bruce Fields" X-Patchwork-Id: 2852231 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 36C99C0AB5 for ; Fri, 30 Aug 2013 21:30:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 73B0C203B6 for ; Fri, 30 Aug 2013 21:30:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 84F4120529 for ; Fri, 30 Aug 2013 21:30:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756339Ab3H3Vaa (ORCPT ); Fri, 30 Aug 2013 17:30:30 -0400 Received: from fieldses.org ([174.143.236.118]:46469 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755660Ab3H3Va2 (ORCPT ); Fri, 30 Aug 2013 17:30:28 -0400 Received: from bfields by fieldses.org with local (Exim 4.76) (envelope-from ) id 1VFWGx-00005m-Rk; Fri, 30 Aug 2013 17:30:27 -0400 Date: Fri, 30 Aug 2013 17:30:27 -0400 To: linux-nfs@vger.kernel.org Cc: Harshula Jayasuriya Subject: [PATCH] Revert "nfsd: nfs4_file_get_access: need to be more careful with O_RDWR" Message-ID: <20130830213027.GA32015@fieldses.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) From: "J. Bruce Fields" Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "J. Bruce Fields" This reverts commit df66e75395c839c3a373bae897dbb1248f741b45. nfsd4_lock can get a read-only or write-only reference when only a read-write open is available. This is normal. Signed-off-by: J. Bruce Fields --- fs/nfsd/nfs4state.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 5e609b1..eb9cf81 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -282,14 +282,19 @@ static unsigned int file_hashval(struct inode *ino) static struct hlist_head file_hashtbl[FILE_HASH_SIZE]; +static void __nfs4_file_get_access(struct nfs4_file *fp, int oflag) +{ + WARN_ON_ONCE(!(fp->fi_fds[oflag] || fp->fi_fds[O_RDWR])); + atomic_inc(&fp->fi_access[oflag]); +} + static void nfs4_file_get_access(struct nfs4_file *fp, int oflag) { - WARN_ON_ONCE(!fp->fi_fds[oflag]); if (oflag == O_RDWR) { - atomic_inc(&fp->fi_access[O_RDONLY]); - atomic_inc(&fp->fi_access[O_WRONLY]); + __nfs4_file_get_access(fp, O_RDONLY); + __nfs4_file_get_access(fp, O_WRONLY); } else - atomic_inc(&fp->fi_access[oflag]); + __nfs4_file_get_access(fp, oflag); } static void nfs4_file_put_fd(struct nfs4_file *fp, int oflag)