From patchwork Fri Aug 21 04:49:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Tao X-Patchwork-Id: 7047901 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id ADF6AC05AC for ; Fri, 21 Aug 2015 04:50:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DF63720638 for ; Fri, 21 Aug 2015 04:50:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 06AE720632 for ; Fri, 21 Aug 2015 04:50:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752044AbbHUEuF (ORCPT ); Fri, 21 Aug 2015 00:50:05 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:36364 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751260AbbHUEuE (ORCPT ); Fri, 21 Aug 2015 00:50:04 -0400 Received: by pawq9 with SMTP id q9so43708755paw.3 for ; Thu, 20 Aug 2015 21:50:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=0LC02lsLvc+19bqJgI183EvL0GrcKOA79DWDN04recY=; b=Q4+SwNtNMmsaE4KOGB7mrDZgdom7Fs8UDSQkkGhpiiyXfUnipmFQbwW6IRx2cwBnxg PzCS67VhLRe9OzfKDACeetn0QnrYe5An7FOEydi2EP3AZKJs6nRgpbTWRIOVvgtJTkku wgHMX4tpWH0vWq6epalA72BPNdrEme+AHqhSEPk3RqSFP6ghZwPuu7UFXyMJXUB9fCZI IaX9wqziXY4WIRujwaf2eSbwbUFups9diPKdGsqvXbzDGcpCExlnpAQgi/4nk6D/AdDp Fb5Wv8e56QqE09xhiIfBJSD7S1xbUNVhJEOJG8Wvfhhn2raCkk/LT9FxFygSLbub9dqk VG1Q== X-Gm-Message-State: ALoCoQkdvxWcDC69Bq41yR2hyaoZ/oNAAGKbl9UfMxZAtJPL2+SNYj4a3VHDo7CJntX6+g7D0dy+ X-Received: by 10.66.144.200 with SMTP id so8mr13312936pab.63.1440132603031; Thu, 20 Aug 2015 21:50:03 -0700 (PDT) Received: from lear.localdomain (63-157-6-18.dia.static.qwest.net. [63.157.6.18]) by smtp.gmail.com with ESMTPSA id ev2sm6094841pbb.37.2015.08.20.21.50.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2015 21:50:02 -0700 (PDT) From: Peng Tao To: Trond Myklebust Cc: linux-nfs@vger.kernel.org, Peng Tao , stable@vger.kernel.org Subject: [PATCH] NFS41: remove NFS_LAYOUT_ROC flag Date: Fri, 21 Aug 2015 12:49:44 +0800 Message-Id: <1440132584-50156-1-git-send-email-tao.peng@primarydata.com> X-Mailer: git-send-email 1.8.3.1 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.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 If we return delegation before closing, we fail to do roc check during close because NFS_LAYOUT_ROC is cleared by delegreturn and it causes layouts to be still hanging around after delegreturn + close, which is a voilation against protocol. Cc: stable@vger.kernel.org Signed-off-by: Peng Tao --- fs/nfs/pnfs.c | 7 ++----- fs/nfs/pnfs.h | 1 - 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index cf90eed..247c5a5 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -1068,8 +1068,7 @@ bool pnfs_roc(struct inode *ino) spin_lock(&ino->i_lock); lo = nfsi->layout; - if (!lo || !test_and_clear_bit(NFS_LAYOUT_ROC, &lo->plh_flags) || - test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags)) + if (!lo || test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags)) goto out_noroc; /* no roc if we hold a delegation */ @@ -1617,10 +1616,8 @@ pnfs_layout_process(struct nfs4_layoutget *lgp) pnfs_get_lseg(lseg); pnfs_layout_insert_lseg(lo, lseg); - if (res->return_on_close) { + if (res->return_on_close) set_bit(NFS_LSEG_ROC, &lseg->pls_flags); - set_bit(NFS_LAYOUT_ROC, &lo->plh_flags); - } spin_unlock(&ino->i_lock); pnfs_free_lseg_list(&free_me); diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index a3d57a8..02c27f9 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h @@ -94,7 +94,6 @@ enum { NFS_LAYOUT_RO_FAILED = 0, /* get ro layout failed stop trying */ NFS_LAYOUT_RW_FAILED, /* get rw layout failed stop trying */ NFS_LAYOUT_BULK_RECALL, /* bulk recall affecting layout */ - NFS_LAYOUT_ROC, /* some lseg had roc bit set */ NFS_LAYOUT_RETURN, /* Return this layout ASAP */ NFS_LAYOUT_RETURN_BEFORE_CLOSE, /* Return this layout before close */ NFS_LAYOUT_INVALID_STID, /* layout stateid id is invalid */