From patchwork Wed Aug 31 02:11:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 9306241 X-Patchwork-Delegate: Trond.Myklebust@netapp.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5963D607F0 for ; Wed, 31 Aug 2016 02:12:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 48E0B28DE7 for ; Wed, 31 Aug 2016 02:12:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3DEA528E08; Wed, 31 Aug 2016 02:12:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1F6D28DE7 for ; Wed, 31 Aug 2016 02:12:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757620AbcHaCMP (ORCPT ); Tue, 30 Aug 2016 22:12:15 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:34161 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758117AbcHaCMO (ORCPT ); Tue, 30 Aug 2016 22:12:14 -0400 Received: by mail-it0-f68.google.com with SMTP id e124so1140907ith.1 for ; Tue, 30 Aug 2016 19:12:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=HSkMS9QF59uRNGzHEMCx0tE0H/IHc0rbV/t8I6OkzBU=; b=r+P4AlLEFS062hVP1j/mmErbW4agXpewtRg1FwtmxR25Vfyoh03x0EORlcQu6VKd8u M34JKYcB2jWsq0e6DNtBMUkD5CLDgDxlIIQa8BnykOXrPwDnBBvhHALqjV5kk47uITmZ mvUxObrrOl8qEk6VSRSD1mf/Ria5Tzjtnb3NO16AqNW5FvIcURTkJy48FkyXlgCj2QGR MCjQSY7gnFO3r8k2Iq9fVd0QsJ/G5DsJ7hm8KuFaVEfMSVyWipH7twoG1pOtBCvw1YLx mUCPuGJH9Wo83XWTYDVObLBuKqA0fzexcIl2HzqwuKFFFYNCnprnXiwPLD0M6gWY8zo0 PGEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=HSkMS9QF59uRNGzHEMCx0tE0H/IHc0rbV/t8I6OkzBU=; b=f5sgX5GTXCU3E9299PUvTyr0EzIYRd6nUf815gFYb3cI+x4FoCJwlA3ygX7tWXUHwX BVRjqIbbgxIejp/j1X4DKbE6kdSuhENV9xzJC6y2R/9FZZxyUV4Gqp3nVW5E1T8wGlIM Q+q2o/v+cxutJROJMdINsoreCVmxSNwsl7wNUm2NnNTW27C8EU0JCOoKbAIMlRb1XPRb 0y8UKx2vzl8ADyS38x/PMAXfn2kSzZiK2lXWoI+OuE1V9osuB98VaN6jhaCPx0lDCuha tWc5wsboGCS6P13q8CbT6APv6IU+AXrMo15YMTR9P1Dv6YuzLIMdgsZGJjXpTrIXspro 4wQg== X-Gm-Message-State: AE9vXwMQqyHrPaezp+yZFm50Tlk0gv2uEZOH5Z0SwgKseA/2Ot2+p57be+iREnNUpjLTxw== X-Received: by 10.107.138.85 with SMTP id m82mr2794017iod.27.1472609533879; Tue, 30 Aug 2016 19:12:13 -0700 (PDT) Received: from leira.trondhjem.org.localdomain (c-68-49-162-121.hsd1.mi.comcast.net. [68.49.162.121]) by smtp.gmail.com with ESMTPSA id x77sm895268ioi.3.2016.08.30.19.12.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Aug 2016 19:12:13 -0700 (PDT) From: Trond Myklebust To: anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH 2/7] NFSv4.1: Allow test_stateid to handle session errors without waiting Date: Tue, 30 Aug 2016 22:11:39 -0400 Message-Id: <1472609504-69094-3-git-send-email-trond.myklebust@primarydata.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472609504-69094-2-git-send-email-trond.myklebust@primarydata.com> References: <1472609504-69094-1-git-send-email-trond.myklebust@primarydata.com> <1472609504-69094-2-git-send-email-trond.myklebust@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If the server crashes while we're testing stateids for validity, then we want to initiate session recovery. Usually, we will be calling from a state manager thread, though, so we don't really want to wait. Signed-off-by: Trond Myklebust --- fs/nfs/nfs4proc.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 255800b12fad..2d2c1a46c3b9 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -8584,6 +8584,23 @@ static int _nfs41_test_stateid(struct nfs_server *server, return -res.status; } +static void nfs4_handle_delay_or_session_error(struct nfs_server *server, + int err, struct nfs4_exception *exception) +{ + exception->retry = 0; + switch(err) { + case -NFS4ERR_DELAY: + nfs4_handle_exception(server, err, exception); + break; + case -NFS4ERR_BADSESSION: + case -NFS4ERR_BADSLOT: + case -NFS4ERR_BAD_HIGH_SLOT: + case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: + case -NFS4ERR_DEADSESSION: + nfs4_do_handle_exception(server, err, exception); + } +} + /** * nfs41_test_stateid - perform a TEST_STATEID operation * @@ -8603,9 +8620,7 @@ static int nfs41_test_stateid(struct nfs_server *server, int err; do { err = _nfs41_test_stateid(server, stateid, cred); - if (err != -NFS4ERR_DELAY) - break; - nfs4_handle_exception(server, err, &exception); + nfs4_handle_delay_or_session_error(server, err, &exception); } while (exception.retry); return err; }