From patchwork Fri Oct 2 17:14:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 7317801 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 ABED6BEEA4 for ; Fri, 2 Oct 2015 17:14:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D82182087B for ; Fri, 2 Oct 2015 17:14:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 078D720876 for ; Fri, 2 Oct 2015 17:14:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753230AbbJBROr (ORCPT ); Fri, 2 Oct 2015 13:14:47 -0400 Received: from mail-qk0-f174.google.com ([209.85.220.174]:35709 "EHLO mail-qk0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753227AbbJBROp (ORCPT ); Fri, 2 Oct 2015 13:14:45 -0400 Received: by qkap81 with SMTP id p81so45639931qka.2 for ; Fri, 02 Oct 2015 10:14:42 -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:in-reply-to :references; bh=Nqk4YiE15nEENxypDLM0OONSh36R/Csw/p2Dca57SyQ=; b=Du6/4aA7AgyCcJG47xw2LyEsob3NywmhUtUJN3m7J09BwMW2ZcUJJgNkimCMR0B8/b xsgdOHUK1PO/FLJQFb5PxJ8kb0d4xOTTHmPloHgqlfcfmi5Jb+bXLbXjZGd9n/nz51dx d9NXIluB6Gji+Di13ysjUC//SmZEKhOxSR14O3PjEQIvX5EvhEmy1gM/T4dhulx2I2h4 SkQuwaPTXlivxrbZeYgJS/vN6nZszHSPvc1WYAqEHjAtC7QMfIlaDmJXxRt7IVHLR4er Mcijq6XD7lY5fvZNfGh5FFQ1qoWNqoqJ67MozwjVFdGodBQPir9BBn/7ghza02iirU3U MG1g== X-Gm-Message-State: ALoCoQnQ/qtwWsrTAV+UjbI5TRUT9tMN16ER4Kz0gyIaviecPqfrwSzGNdEf5c+4pS6bvIkVTf53 X-Received: by 10.55.33.35 with SMTP id h35mr10615396qkh.71.1443806082606; Fri, 02 Oct 2015 10:14:42 -0700 (PDT) Received: from tlielax.poochiereds.net ([2606:a000:1125:6079::d5a]) by smtp.googlemail.com with ESMTPSA id q67sm4989485qha.30.2015.10.02.10.14.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Oct 2015 10:14:41 -0700 (PDT) From: Jeff Layton X-Google-Original-From: Jeff Layton To: trond.myklebust@primarydata.com Cc: linux-nfs@vger.kernel.org, Anna Schumaker Subject: [PATCH v2] nfs4: reset states to use open_stateid when returning delegation voluntarily Date: Fri, 2 Oct 2015 13:14:37 -0400 Message-Id: <1443806077-27148-1-git-send-email-jeff.layton@primarydata.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1443784739-8565-1-git-send-email-jeff.layton@primarydata.com> References: <1443784739-8565-1-git-send-email-jeff.layton@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 When the client goes to return a delegation, it should always update any nfs4_state currently set up to use that delegation stateid to instead use the open stateid. It already does do this in some cases, particularly in the state recovery code, but not currently when the delegation is voluntarily returned (e.g. in advance of a RENAME). This causes the client to try to continue using the delegation stateid after the DELEGRETURN, e.g. in LAYOUTGET. Set the nfs4_state back to using the open stateid in nfs4_open_delegation_recall, just before clearing the NFS_DELEGATED_STATE bit. Signed-off-by: Jeff Layton --- fs/nfs/nfs4proc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index f93b9cdb4934..246753e1d19d 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -1771,6 +1771,9 @@ int nfs4_open_delegation_recall(struct nfs_open_context *ctx, if (IS_ERR(opendata)) return PTR_ERR(opendata); nfs4_stateid_copy(&opendata->o_arg.u.delegation, stateid); + write_seqlock(&state->seqlock); + nfs4_stateid_copy(&state->stateid, &state->open_stateid); + write_sequnlock(&state->seqlock); clear_bit(NFS_DELEGATED_STATE, &state->flags); switch (type & (FMODE_READ|FMODE_WRITE)) { case FMODE_READ|FMODE_WRITE: