From patchwork Thu May 8 00:16:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: rongzeng@us.ibm.com X-Patchwork-Id: 4137641 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7C925BFF02 for ; Thu, 8 May 2014 16:17:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 95B522018A for ; Thu, 8 May 2014 16:17:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8B2BB2016C for ; Thu, 8 May 2014 16:17:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754809AbaEHQRb (ORCPT ); Thu, 8 May 2014 12:17:31 -0400 Received: from e32.co.us.ibm.com ([32.97.110.150]:35918 "EHLO e32.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754399AbaEHQR1 (ORCPT ); Thu, 8 May 2014 12:17:27 -0400 Received: from /spool/local by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 May 2014 10:17:26 -0600 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e32.co.us.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 May 2014 10:17:25 -0600 Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id A93D119D806D for ; Thu, 8 May 2014 10:17:18 -0600 (MDT) Received: from d03av06.boulder.ibm.com (d03av06.boulder.ibm.com [9.17.195.245]) by b03cxnp08025.gho.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s48GHO0g40632554 for ; Thu, 8 May 2014 18:17:24 +0200 Received: from d03av06.boulder.ibm.com (loopback [127.0.0.1]) by d03av06.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id s48GLEdO019370 for ; Thu, 8 May 2014 10:21:15 -0600 Received: from oc2542071013.ibm.com ([9.49.214.246]) by d03av06.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id s48GLD4w019176 for ; Thu, 8 May 2014 10:21:14 -0600 Received: from imap.linux.ibm.com ([unix socket]) by maier.raleigh.ibm.com (Cyrus v2.3.16-Fedora-RPM-2.3.16-6.el6_2.5) with LMTPA; Wed, 07 May 2014 20:18:03 -0400 X-Sieve: CMU Sieve 2.3 Received: from localhost (localhost [127.0.0.1]) by imap.linux.ibm.com (Postfix) with ESMTP id 998101600005 for ; Wed, 7 May 2014 20:18:03 -0400 (EDT) X-Virus-Scanned: amavisd-new at linux.ibm.com X-Spam-Score: -1.272 X-Spam-Level: X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD,TVD_RCVD_SPACE_BRACKET,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from imap.linux.ibm.com ([127.0.0.1]) by localhost (maier.raleigh.ibm.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id IySD0trl2ujq for ; Wed, 7 May 2014 20:18:02 -0400 (EDT) Received: from smtp.linux.ibm.com (smtp.linux.ibm.com [9.26.4.197]) by imap.linux.ibm.com (Postfix) with ESMTP id 96B041600004 for ; Wed, 7 May 2014 20:18:02 -0400 (EDT) Received: from TCVM.MEGACENTER.DE.IBM.COM (tcvm.megacenter.de.ibm.com [9.149.201.81]) by smtp.linux.ibm.com (Postfix) with SMTP id EFC94C79F7 for ; Wed, 7 May 2014 20:18:01 -0400 (EDT) Received: by TCVM.MEGACENTER.DE.IBM.COM (IBM VM SMTP Level 620) via spool with SMTP id 7060 ; Thu, 08 May 2014 00:18:01 UTC Received: by emeavsc.vnet.ibm.com (xagsmtp 2.0.1) via smtp2 with spool id 2634; Thu, 8 May 2014 00:18:01 +0000 Received: from b03cxnp07028.gho.boulder.ibm.com [9.17.130.15] by TCVM.MEGACENTER.DE.IBM.COM (IBM VM SMTP Level 620) via TCP with ESMTP ; Thu, 08 May 2014 00:18:00 UTC Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by b03cxnp07028.gho.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s480Gma39568756 for ; Thu, 8 May 2014 02:16:56 +0200 Received: from d03av03.boulder.ibm.com (localhost [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s480HRSa010027 for ; Wed, 7 May 2014 18:17:27 -0600 Received: from oc1547780626.ibm.com (sig-9-65-9-8.mts.ibm.com [9.65.9.8]) by d03av03.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s480HQwF008804 for ; Wed, 7 May 2014 18:17:27 -0600 Received: by oc1547780626.ibm.com (Postfix, from userid 500) id 671D061306; Wed, 7 May 2014 17:17:01 -0700 (PDT) From: rongzeng@us.ibm.com To: jvrao@linux.vnet.ibm.com Cc: rongzeng@us.ibm.com, rong zeng Subject: [PATCH] Adding a callback for incoming sm_notify to better handle stale lock issue in client crash recovery in HA-NFS environment. The callout parameters are: Date: Wed, 7 May 2014 17:16:58 -0700 Message-Id: <1399508218-7659-1-git-send-email-rongzeng@us.ibm.com> X-Mailer: git-send-email 1.7.1 X-TM-AS-MML: disable X-Xagent-Gateway: emeavsc.vnet.ibm.com (XAGSMTP at EMEAVSC) X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14050816-0928-0000-0000-000001CC077A Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: rong zeng 1. "sm-notify" - callout name 2. monitored client name as in the SM_NOTIFY request 3. IP of the sender of the SM_NOITFY request. 4. state value in the SM_NOTIFY request This new interface can be used by different HA-NFS product in its specific configuration and environment to recover from the client crash and stale lock scenarios. Signed-off-by: Rong Zeng --- utils/statd/callback.c | 13 ++++++++----- utils/statd/statd.man | 20 ++++++++++++++++---- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/utils/statd/callback.c b/utils/statd/callback.c index d1cc139..58ba70b 100644 --- a/utils/statd/callback.c +++ b/utils/statd/callback.c @@ -15,6 +15,7 @@ #include "rpcmisc.h" #include "statd.h" #include "notlist.h" +#include "ha-callout.h" /* Callback notify list. */ /* notify_list *cbnl = NULL; ... never used */ @@ -87,6 +88,13 @@ sm_notify_1_svc(struct stat_chge *argp, struct svc_req *rqstp) xlog(D_CALL, "Received SM_NOTIFY from %s, state: %d", argp->mon_name, argp->state); + if (!statd_present_address(sap, ip_addr, sizeof(ip_addr))) { + xlog_warn("Unrecognized sender address"); + return ((void *) &result); + } + + ha_callout("sm-notify", argp->mon_name, ip_addr, argp->state); + /* quick check - don't bother if we're not monitoring anyone */ if (rtnl == NULL) { xlog_warn("SM_NOTIFY from %s while not monitoring any hosts", @@ -94,11 +102,6 @@ sm_notify_1_svc(struct stat_chge *argp, struct svc_req *rqstp) return ((void *) &result); } - if (!statd_present_address(sap, ip_addr, sizeof(ip_addr))) { - xlog_warn("Unrecognized sender address"); - return ((void *) &result); - } - /* okir change: statd doesn't remove the remote host from its * internal monitor list when receiving an SM_NOTIFY call from * it. Lockd will want to continue monitoring the remote host diff --git a/utils/statd/statd.man b/utils/statd/statd.man index 896c2f8..1e5520c 100644 --- a/utils/statd/statd.man +++ b/utils/statd/statd.man @@ -346,7 +346,8 @@ points due to inactivity. .SS High-availability callouts .B rpc.statd can exec a special callout program during processing of -successful SM_MON, SM_UNMON, and SM_UNMON_ALL requests. +successful SM_MON, SM_UNMON, and SM_UNMON_ALL requests, +or when it receives SM_NOTIFY. Such a program may be used in High Availability NFS (HA-NFS) environments to track lock state that may need to be migrated after a system reboot. @@ -357,15 +358,26 @@ option. The program is run with 3 arguments: The first is either .B add-client -or .B del-client +or +.B sm-notify depending on the reason for the callout. The second is the .I mon_name of the monitored peer. The third is the -.I caller_name -of the requesting lock manager. +.I caller_name +of the requesting lock manager for +.B add-client +or +.B del-client +, otherwise it is +.I IP_address +of the caller sending SM_NOTIFY. +The forth is the +.I state_value +in the SM_NOTIFY request. + .SS IPv6 and TI-RPC support TI-RPC is a pre-requisite for supporting NFS on IPv6. If TI-RPC support is built into