From patchwork Mon Aug 4 08:18:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 4667381 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 B16F89F37E for ; Mon, 4 Aug 2014 08:18:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CA9F220200 for ; Mon, 4 Aug 2014 08:18:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D1AC3201FE for ; Mon, 4 Aug 2014 08:18:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751713AbaHDISa (ORCPT ); Mon, 4 Aug 2014 04:18:30 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:54468 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751710AbaHDIS3 (ORCPT ); Mon, 4 Aug 2014 04:18:29 -0400 Received: by mail-pa0-f43.google.com with SMTP id lf10so9574231pab.16 for ; Mon, 04 Aug 2014 01:18:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=QGisS6zG3/fPbya9iHCd4PdolLZIU0I5UKbqPE+PSNw=; b=n09Ylr3mo5r5jhWfDR4GDEKe0LZrU8cIZQAzsTOvlyZJIz7So3dO/mYFQ3Yzf5A1ug isx4kdVYN3+ib+18sxchZMB2FmXgYY7sWK24CS0ReFjX/sXL0QURSh7ajcw31ImbVYuI +5S1o1G62MOCQCyAHIZ3CwnAuqfgwBzE2wjk9Cy5oro4lgQnLMYL9NQHQrSE50MaWIh4 0BXWH68IIu4E5GODqo1sf2mDZIMBFluX+xbQiyWvTxa5AvvRxQOIFIeVBXNUXTHoSkPW W8HZfsowaxBDkE0UJMAYb6E1ujt7hp3e2ZwT9QA1iuvqkUI8CquRYm8hOmMm6iokBhfA bJEg== X-Received: by 10.66.66.135 with SMTP id f7mr22636570pat.32.1407140309105; Mon, 04 Aug 2014 01:18:29 -0700 (PDT) Received: from [192.168.0.100] ([110.190.119.243]) by mx.google.com with ESMTPSA id pp2sm25517347pdb.59.2014.08.04.01.18.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Aug 2014 01:18:28 -0700 (PDT) Message-ID: <53DF41C8.70303@gmail.com> Date: Mon, 04 Aug 2014 16:18:16 +0800 From: Kinglong Mee User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: Trond Myklebust CC: Chuck Lever , Linux NFS Mailing List Subject: [PATCH v2] NFS: Avoid infinite loop when RELEASE_LOCKOWNER getting expired error References: <53DE56C7.2080407@gmail.com> In-Reply-To: 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, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Fix Commit 60ea681299 (NFS: Migration support for RELEASE_LOCKOWNER) If getting expired error, client will enter a infinite loop as, client server RELEASE_LOCKOWNER(old clid) -----> <--- expired error RENEW(old clid) -----> <--- expired error SETCLIENTID -----> <--- a new clid SETCLIENTID_CONFIRM (new clid) --> <--- ok RELEASE_LOCKOWNER(old clid) -----> <--- expired error RENEW(new clid) -----> <-- ok RELEASE_LOCKOWNER(old clid) -----> <--- expired error RENEW(new clid) -----> <-- ok ... ... Signed-off-by: Kinglong Mee --- fs/nfs/nfs4proc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 285ad53..75dcce29c 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -5834,8 +5834,10 @@ struct nfs_release_lockowner_data { static void nfs4_release_lockowner_prepare(struct rpc_task *task, void *calldata) { struct nfs_release_lockowner_data *data = calldata; - nfs40_setup_sequence(data->server, - &data->args.seq_args, &data->res.seq_res, task); + struct nfs_server *server = data->server; + nfs40_setup_sequence(server, &data->args.seq_args, + &data->res.seq_res, task); + data->args.lock_owner.clientid = server->nfs_client->cl_clientid; data->timestamp = jiffies; } @@ -5852,6 +5854,8 @@ static void nfs4_release_lockowner_done(struct rpc_task *task, void *calldata) break; case -NFS4ERR_STALE_CLIENTID: case -NFS4ERR_EXPIRED: + nfs4_async_handle_error(task, server, NULL); + break; case -NFS4ERR_LEASE_MOVED: case -NFS4ERR_DELAY: if (nfs4_async_handle_error(task, server, NULL) == -EAGAIN)