From patchwork Wed Aug 19 13:01:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 7037311 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DBC869F344 for ; Wed, 19 Aug 2015 13:01:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B6217205F0 for ; Wed, 19 Aug 2015 13:01:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B18BF205ED for ; Wed, 19 Aug 2015 13:01:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751239AbbHSNBW (ORCPT ); Wed, 19 Aug 2015 09:01:22 -0400 Received: from mail-ig0-f182.google.com ([209.85.213.182]:36385 "EHLO mail-ig0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751056AbbHSNBW (ORCPT ); Wed, 19 Aug 2015 09:01:22 -0400 Received: by igxp17 with SMTP id p17so104546840igx.1 for ; Wed, 19 Aug 2015 06:01:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=win8zllVb0VLEgaXOVH1EF/p//cVEPuB0IVF5Q6Wtos=; b=vJduLJuw9K3tNvLTaOCo1MyvjzkXDMIV+48Bz3IuADUS7syM+xLq7UbGMXlGefjkWE m9DeceEJt52n7z4zGIZS01x+mUfOzoyOKhVMUAMQN9HjzwxvLexnp8JJ/9Vb9MQcZZXn S11eYffnO6daBN2uYW7PXD4AZM3HPZdTib1PUe85QKZJT4jyhm69d9OvM897pRNoURxe SQt7mPj0BcAUGIIkyuCotjipvncg7pkwu1Qgg2JjvO31kuyZPLsGlSXMx4FPA6+1b+29 1J+xuAKMsxsHxB8cf9WeBQv36PPbf6PHyibmDUZwKjv6foRdiMb0wxLH4Joxo23F72Gx 8tMw== MIME-Version: 1.0 X-Received: by 10.50.108.100 with SMTP id hj4mr29318029igb.65.1439989281487; Wed, 19 Aug 2015 06:01:21 -0700 (PDT) Received: by 10.107.4.6 with HTTP; Wed, 19 Aug 2015 06:01:21 -0700 (PDT) In-Reply-To: <1439961497-22176-1-git-send-email-trond.myklebust@primarydata.com> References: <1439961497-22176-1-git-send-email-trond.myklebust@primarydata.com> Date: Wed, 19 Aug 2015 09:01:21 -0400 X-Google-Sender-Auth: d-Pslxk1IL-OeRULZAah988eo6w Message-ID: Subject: Re: [PATCH] Revert "NFSv4: Remove incorrect check in can_open_delegated()" From: Olga Kornievskaia To: Trond Myklebust Cc: linux-nfs Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 Alternatively, I think the following would fix the problem too. If this open for CLAIM_PREVIOUS, we don't need to check if it can be open delegated. On Wed, Aug 19, 2015 at 1:18 AM, Trond Myklebust wrote: > This reverts commit 4e379d36c050b0117b5d10048be63a44f5036115. > > This commit opens up a race between the recovery code and the open code. > > Reported-by: Olga Kornievskaia > Cc: stable@vger.kernel # v4.0+ > Signed-off-by: Trond Myklebust > --- > fs/nfs/nfs4proc.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c > index 9e9f7816cf24..95c5e8d39bef 100644 > --- a/fs/nfs/nfs4proc.c > +++ b/fs/nfs/nfs4proc.c > @@ -1156,6 +1156,8 @@ static int can_open_delegated(struct nfs_delegation *delegation, fmode_t fmode) > return 0; > if ((delegation->type & fmode) != fmode) > return 0; > + if (test_bit(NFS_DELEGATION_NEED_RECLAIM, &delegation->flags)) > + return 0; > if (test_bit(NFS_DELEGATION_RETURNING, &delegation->flags)) > return 0; > nfs_mark_delegation_referenced(delegation); > -- > 2.4.3 > --- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 3acb1eb..b53cb10 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -1866,7 +1866,8 @@ static void nfs4_open_prepare(struct rpc_task *task, void goto out_no_action; rcu_read_lock(); delegation = rcu_dereference(NFS_I(data->state->inode)->delegati - if (data->o_arg.claim != NFS4_OPEN_CLAIM_DELEGATE_CUR && + if (data->o_arg.claim != NFS4_OPEN_CLAIM_PREVIOUS && + data->o_arg.claim != NFS4_OPEN_CLAIM_DELEGATE_CUR && data->o_arg.claim != NFS4_OPEN_CLAIM_DELEG_CUR_FH && can_open_delegated(delegation, data->o_arg.fmode)) goto unlock_no_action;