From patchwork Mon Nov 3 14:36:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 5216981 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5F6C69F380 for ; Mon, 3 Nov 2014 14:36:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 86D542012E for ; Mon, 3 Nov 2014 14:36:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 300CF20125 for ; Mon, 3 Nov 2014 14:36:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751852AbaKCOgs (ORCPT ); Mon, 3 Nov 2014 09:36:48 -0500 Received: from mx11.netapp.com ([216.240.18.76]:50696 "EHLO mx11.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751698AbaKCOgr (ORCPT ); Mon, 3 Nov 2014 09:36:47 -0500 X-IronPort-AV: E=Sophos;i="5.07,308,1413270000"; d="scan'208";a="164858295" Received: from vmwexchts04-prd.hq.netapp.com ([10.122.105.32]) by mx11-out.netapp.com with ESMTP; 03 Nov 2014 06:36:47 -0800 Received: from smtp1.corp.netapp.com (10.57.156.124) by VMWEXCHTS04-PRD.hq.netapp.com (10.122.105.32) with Microsoft SMTP Server id 15.0.995.29; Mon, 3 Nov 2014 06:36:47 -0800 Received: from vpn2ntap-316904.vpn.netapp.com (vpn2ntap-316904.vpn.netapp.com [10.55.68.140]) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id sA3EakbQ014034; Mon, 3 Nov 2014 06:36:46 -0800 (PST) From: Olga Kornievskaia To: CC: Subject: [PATCH 1/1] Fixing infinite state recovery loop due to failed delegation return Date: Mon, 3 Nov 2014 09:36:43 -0500 Message-ID: <1415025403-31914-1-git-send-email-kolga@netapp.com> X-Mailer: git-send-email 1.9.3 (Apple Git-50) MIME-Version: 1.0 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 get a bad-stateid-type of error when we send OPEN with delegate_cur to return currently held delegation, we shouldn't be trying to reclaim locks associated with that delegation state_id because we don't have an open_stateid to be used for the LOCK operation. Thus, we should return an error from the nfs4_open_delegation_recall() in that case. Furthermore, if an error occurs the delegation code will call nfs_abort_delegation_return() which sets again the NFS4CLNT_DELEGRETURN flags in the state and it leads the state manager to into an infinite loop for trying to reclaim the delegated state. Signed-off-by: Olga Kornievskaia --- fs/nfs/delegation.c | 5 +++-- fs/nfs/nfs4proc.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index 5853f53..8016d89 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c @@ -394,7 +394,7 @@ static int nfs_end_delegation_return(struct inode *inode, struct nfs_delegation err = nfs4_wait_clnt_recover(clp); } while (err == 0); - if (err) { + if (err && err != -EIO) { nfs_abort_delegation_return(delegation, clp); goto out; } @@ -458,7 +458,8 @@ restart: iput(inode); if (!err) goto restart; - set_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state); + if (err != -EIO) + set_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state); return err; } } diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 5aa55c1..6871055 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -1655,7 +1655,7 @@ static int nfs4_handle_delegation_recall_error(struct nfs_server *server, struct nfs_inode_find_state_and_recover(state->inode, stateid); nfs4_schedule_stateid_recovery(server, state); - return 0; + return -EIO; case -NFS4ERR_DELAY: case -NFS4ERR_GRACE: set_bit(NFS_DELEGATED_STATE, &state->flags);