From patchwork Sun Apr 21 22:14:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 2469651 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 37CB3DF230 for ; Sun, 21 Apr 2013 22:14:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752543Ab3DUWOP (ORCPT ); Sun, 21 Apr 2013 18:14:15 -0400 Received: from mx12.netapp.com ([216.240.18.77]:65120 "EHLO mx12.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752238Ab3DUWOO (ORCPT ); Sun, 21 Apr 2013 18:14:14 -0400 X-IronPort-AV: E=Sophos;i="4.87,521,1363158000"; d="scan'208";a="43207190" Received: from smtp1.corp.netapp.com ([10.57.156.124]) by mx12-out.netapp.com with ESMTP; 21 Apr 2013 15:14:14 -0700 Received: from leira.trondhjem.org.com ([10.63.238.165]) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id r3LMEBjP028821; Sun, 21 Apr 2013 15:14:12 -0700 (PDT) From: Trond Myklebust To: linux-nfs@vger.kernel.org Cc: Marc Eshel , Chuck Lever , Malahal Naineni , Manoj Naik , Shuzheng Liu , Steve Dickson , Tomer Perry Subject: [PATCH] LOCKD: Ensure that nlmclnt_block resets block->b_status after a server reboot Date: Sun, 21 Apr 2013 18:14:09 -0400 Message-Id: <1366582449-25569-1-git-send-email-Trond.Myklebust@netapp.com> X-Mailer: git-send-email 1.8.1.4 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org After a server reboot, the reclaimer thread will recover all the existing locks. For locks that are blocked, however, it will change the value of block->b_status to nlm_lck_denied_grace_period in order to signal that they need to wake up and resend the original blocking lock request. Due to a bug, however, the block->b_status never gets reset after the blocked locks have been woken up, and so the process goes into an infinite loop of resends until the blocked lock is satisfied. Reported-by: Marc Eshel Signed-off-by: Trond Myklebust Cc: stable@vger.kernel.org --- fs/lockd/clntlock.c | 3 +++ fs/lockd/clntproc.c | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c index 0796c45..01bfe76 100644 --- a/fs/lockd/clntlock.c +++ b/fs/lockd/clntlock.c @@ -144,6 +144,9 @@ int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout) timeout); if (ret < 0) return -ERESTARTSYS; + /* Reset the lock status after a server reboot so we resend */ + if (block->b_status == nlm_lck_denied_grace_period) + block->b_status = nlm_lck_blocked; req->a_res.status = block->b_status; return 0; } diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c index 7e529c3..9760ecb 100644 --- a/fs/lockd/clntproc.c +++ b/fs/lockd/clntproc.c @@ -550,9 +550,6 @@ again: status = nlmclnt_block(block, req, NLMCLNT_POLL_TIMEOUT); if (status < 0) break; - /* Resend the blocking lock request after a server reboot */ - if (resp->status == nlm_lck_denied_grace_period) - continue; if (resp->status != nlm_lck_blocked) break; }