Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp79400ybx; Thu, 31 Oct 2019 16:16:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqyDjGmLylADg6m5ZTMRa3I8q/I1NeyRwBhElJHaxu+oKNFi2nYKX24vUN4fKV8q7K967j5v X-Received: by 2002:a50:b584:: with SMTP id a4mr1678533ede.249.1572563773701; Thu, 31 Oct 2019 16:16:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572563773; cv=none; d=google.com; s=arc-20160816; b=0Z7YAoKIouC5iTJ3hgTRYh6GPv6xAYLlvoZPsGrVXYS5ghrK82sA0mAOl3nZOEZAYh 5r+k19mLNP+zqcanlbjyC0WlmpQ4ZEUTb2z0xRZf5EnPJEoblm1e95Bf0X32QedIXy0V z8evod/NapLaCWkz9e+Brf9XNrfh/IB8Bv8PuMW9cJmnlk0+aVrxQihXdEqMR+19HrRH ILK+SmJJ0yK6Nt882xhK1GBNwMceja0+NE0meG5kktkPy1hWdrELx+/D8hPorLiv8MJ7 d7SQXB7RdJYkxSzDlbzhHSWgGzAa4Wml8taEgMBKADIM2hu4zaXlKkVG9UZY3OHc32KZ hRpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=IIX8Z8mWhJCHEQrj2Qtpg+z0E9LTeoAQUosLeSg92SE=; b=r0VB9R5969cI/UVkN8qfE0ziBPgGHtja6qIUF6fKM5ZmmDM99qPiH/o0VAS02/LptY D6rXhuzFMOxzvh0aATBBaekAuemsAh0MFli+8DMnx/7664VU6Dk81dvBQklDNIVNuzjO nwj6NmKwaOMF5OQcnvQPo3z0NhUwRj3RqA4St8fH9RoKuSWz/XRZPS95yQIjg0vcOQpz M07fSRc9qXwT+YCsPHPx/PKqaWqmUUCdSHJg2EV2mnh/puud96baeDa8OY9vIVIt6tFN gzjZHCgkxzI+QbZdEJaGy7bjpnpYWZPPlUK6Dwy7fkKxBs7lOhc1Qxe5vaWvhmJkBiAp bpLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GrX8UUOE; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j25si4665985ejt.4.2019.10.31.16.15.49; Thu, 31 Oct 2019 16:16:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GrX8UUOE; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727842AbfJaWnT (ORCPT + 99 others); Thu, 31 Oct 2019 18:43:19 -0400 Received: from mail-yw1-f66.google.com ([209.85.161.66]:39247 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727611AbfJaWnT (ORCPT ); Thu, 31 Oct 2019 18:43:19 -0400 Received: by mail-yw1-f66.google.com with SMTP id k127so2785386ywc.6 for ; Thu, 31 Oct 2019 15:43:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=IIX8Z8mWhJCHEQrj2Qtpg+z0E9LTeoAQUosLeSg92SE=; b=GrX8UUOEE74gx4N6R9jjmg05RjAYoXRJo0GQtZXgwXmgtUcd4UbVt6BIsJy7wskcvy xX3Yk/832jWeOkEkAF78h1O9l12lui/Ky0/sc5FfCD8SvgQwdoXkpNnmFD5awhr35zgS GBvr3e3557X+CNYoET5y4HD+FKJbfQfAkC3ABxEbvNoRC+1FpYjGtRz971FsLLiAwp+g BZbCLFshUog4FiHjJ56jTBIiQfCWXBCfIaTmgpecsOMrsdfHClU3Ii1iJs8wFd5X9IQL KL/+T+S4wzPxS55KPmNxiQ3OBVy6Hq1VfOOL4phTbYsIe/xLDsON85kQiAwGZRlxTH1P 8dtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IIX8Z8mWhJCHEQrj2Qtpg+z0E9LTeoAQUosLeSg92SE=; b=c/8o5L1wFQS1ogc5u+h/Bz71jZQ4MaUSM1YbVUQRWb9EH9NfWXmCmPWtaioTBY5bRW sO5E/K2LU+AmqCDbMh2NtqupOty8nrhEhI3XAzfllwQMslI5Q2Ank7bY0uV5Oksl0mDz ucrX65N4Q0xFWXKqv2hicrNIPHPTEh3E6i2bnI92LeLw44LyL/nSOdLD46I6T5C3sGYq QgLFHYlQdZ0bsSQ2upe1l5aiU03Opk5Pnx8Z2WoRK/4nKtc/n85AIy6BYNnOF6zlWmqp 6NMOzW7Hw6j8neQHZAzmnVvrXoyHEZE6+86PLEd1AHU94jF7jDSI2ZWF1kXKbUOYUALx HSoA== X-Gm-Message-State: APjAAAW/In9GFf8gSye1DycEzUijbK2cqknWZKGGMnbRTZ4rffLZLfK3 eYYT/h/Bhby5Bv3fWqkUbWjVB/c= X-Received: by 2002:a81:9ad3:: with SMTP id r202mr6407754ywg.152.1572561797912; Thu, 31 Oct 2019 15:43:17 -0700 (PDT) Received: from localhost.localdomain ([50.105.87.1]) by smtp.gmail.com with ESMTPSA id d192sm1720287ywb.3.2019.10.31.15.43.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2019 15:43:17 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH v2 11/20] NFSv4: Update the stateid seqid in nfs_revoke_delegation() Date: Thu, 31 Oct 2019 18:40:42 -0400 Message-Id: <20191031224051.8923-12-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191031224051.8923-11-trond.myklebust@hammerspace.com> References: <20191031224051.8923-1-trond.myklebust@hammerspace.com> <20191031224051.8923-2-trond.myklebust@hammerspace.com> <20191031224051.8923-3-trond.myklebust@hammerspace.com> <20191031224051.8923-4-trond.myklebust@hammerspace.com> <20191031224051.8923-5-trond.myklebust@hammerspace.com> <20191031224051.8923-6-trond.myklebust@hammerspace.com> <20191031224051.8923-7-trond.myklebust@hammerspace.com> <20191031224051.8923-8-trond.myklebust@hammerspace.com> <20191031224051.8923-9-trond.myklebust@hammerspace.com> <20191031224051.8923-10-trond.myklebust@hammerspace.com> <20191031224051.8923-11-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org If we revoke a delegation, but the stateid's seqid is newer, then ensure we update the seqid when marking the delegation as revoked. Signed-off-by: Trond Myklebust --- fs/nfs/delegation.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index a0f798d3c74f..aff2416dc277 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c @@ -771,8 +771,19 @@ static bool nfs_revoke_delegation(struct inode *inode, if (stateid == NULL) { nfs4_stateid_copy(&tmp, &delegation->stateid); stateid = &tmp; - } else if (!nfs4_stateid_match(stateid, &delegation->stateid)) - goto out; + } else { + if (!nfs4_stateid_match_other(stateid, &delegation->stateid)) + goto out; + spin_lock(&delegation->lock); + if (stateid->seqid) { + if (nfs4_stateid_is_newer(&delegation->stateid, stateid)) { + spin_unlock(&delegation->lock); + goto out; + } + delegation->stateid.seqid = stateid->seqid; + } + spin_unlock(&delegation->lock); + } nfs_mark_delegation_revoked(NFS_SERVER(inode), delegation); ret = true; out: -- 2.23.0