Return-Path: Received: from mail-qt0-f194.google.com ([209.85.216.194]:35048 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932855AbcITQ4v (ORCPT ); Tue, 20 Sep 2016 12:56:51 -0400 Received: by mail-qt0-f194.google.com with SMTP id 38so723332qte.2 for ; Tue, 20 Sep 2016 09:56:51 -0700 (PDT) From: Trond Myklebust To: anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org, Oleg Drokin Subject: [PATCH v6 25/29] NFSv4: nfs4_do_handle_exception() handle revoke/expiry of a single stateid Date: Tue, 20 Sep 2016 12:56:07 -0400 Message-Id: <1474390571-17106-26-git-send-email-trond.myklebust@primarydata.com> In-Reply-To: <1474390571-17106-25-git-send-email-trond.myklebust@primarydata.com> References: <1474390571-17106-1-git-send-email-trond.myklebust@primarydata.com> <1474390571-17106-2-git-send-email-trond.myklebust@primarydata.com> <1474390571-17106-3-git-send-email-trond.myklebust@primarydata.com> <1474390571-17106-4-git-send-email-trond.myklebust@primarydata.com> <1474390571-17106-5-git-send-email-trond.myklebust@primarydata.com> <1474390571-17106-6-git-send-email-trond.myklebust@primarydata.com> <1474390571-17106-7-git-send-email-trond.myklebust@primarydata.com> <1474390571-17106-8-git-send-email-trond.myklebust@primarydata.com> <1474390571-17106-9-git-send-email-trond.myklebust@primarydata.com> <1474390571-17106-10-git-send-email-trond.myklebust@primarydata.com> <1474390571-17106-11-git-send-email-trond.myklebust@primarydata.com> <1474390571-17106-12-git-send-email-trond.myklebust@primarydata.com> <1474390571-17106-13-git-send-email-trond.myklebust@primarydata.com> <1474390571-17106-14-git-send-email-trond.myklebust@primarydata.com> <1474390571-17106-15-git-send-email-trond.myklebust@primarydata.com> <1474390571-17106-16-git-send-email-trond.myklebust@primarydata.com> <1474390571-17106-17-git-send-email-trond.myklebust@primarydata.com> <1474390571-17106-18-git-send-email-trond.myklebust@primarydata.com> <1474390571-17106-19-git-send-email-trond.myklebust@primarydata.com> <1474390571-17106-20-git-send-email-trond.myklebust@primarydata.com> <1474390571-17106-21-git-send-email-trond.myklebust@primarydata.com> <1474390571-17106-22-git-send-email-trond.myklebust@primarydata.com> <1474390571-17106-23-git-send-email-trond.myklebust@primarydata.com> <1474390571-17106-24-git-send-email-trond.myklebust@primarydata.com> <1474390571-17106-25-git-send-email-trond.myklebust@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org List-ID: If we're not yet sure that all state has expired or been revoked, we should try to do a minimal recovery on just the one stateid. Signed-off-by: Trond Myklebust --- fs/nfs/nfs4proc.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 338684195e95..552bea2af811 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -397,13 +397,23 @@ static int nfs4_do_handle_exception(struct nfs_server *server, exception->delay = 0; exception->recovering = 0; exception->retry = 0; + + if (stateid == NULL && state != NULL) + stateid = &state->stateid; + switch(errorcode) { case 0: return 0; - case -NFS4ERR_OPENMODE: case -NFS4ERR_DELEG_REVOKED: case -NFS4ERR_ADMIN_REVOKED: + case -NFS4ERR_EXPIRED: case -NFS4ERR_BAD_STATEID: + if (inode != NULL && stateid != NULL) { + nfs_inode_find_state_and_recover(inode, + stateid); + goto wait_on_recovery; + } + case -NFS4ERR_OPENMODE: if (inode) { int err; @@ -422,12 +432,6 @@ static int nfs4_do_handle_exception(struct nfs_server *server, if (ret < 0) break; goto wait_on_recovery; - case -NFS4ERR_EXPIRED: - if (state != NULL) { - ret = nfs4_schedule_stateid_recovery(server, state); - if (ret < 0) - break; - } case -NFS4ERR_STALE_STATEID: case -NFS4ERR_STALE_CLIENTID: nfs4_schedule_lease_recovery(clp); -- 2.7.4