From patchwork Tue May 20 12:02:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 4209081 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 399209F32A for ; Tue, 20 May 2014 12:02:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 214B12035D for ; Tue, 20 May 2014 12:02:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1EF5220353 for ; Tue, 20 May 2014 12:02:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751196AbaETMCp (ORCPT ); Tue, 20 May 2014 08:02:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51140 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751161AbaETMCo (ORCPT ); Tue, 20 May 2014 08:02:44 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s4KC2e09005029 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 20 May 2014 08:02:41 -0400 Received: from smallhat.boston.devel.redhat.com (vpn-58-9.rdu2.redhat.com [10.10.58.9]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s4KC2bSB014797; Tue, 20 May 2014 08:02:39 -0400 Message-ID: <537B445A.60707@RedHat.com> Date: Tue, 20 May 2014 08:02:34 -0400 From: Steve Dickson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Linux NFS Mailing list CC: jvrao@linux.vnet.ibm.com, 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: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 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 [ Forwarding this on to the mailing list ] 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