From patchwork Wed May 7 21:46:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jvrao X-Patchwork-Id: 4132131 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 26C1EBFF02 for ; Wed, 7 May 2014 21:46:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6370E20222 for ; Wed, 7 May 2014 21:46:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6728920212 for ; Wed, 7 May 2014 21:46:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751470AbaEGVqM (ORCPT ); Wed, 7 May 2014 17:46:12 -0400 Received: from e36.co.us.ibm.com ([32.97.110.154]:48686 "EHLO e36.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751351AbaEGVqL (ORCPT ); Wed, 7 May 2014 17:46:11 -0400 Received: from /spool/local by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 7 May 2014 15:46:10 -0600 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e36.co.us.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 7 May 2014 15:46:08 -0600 Received: from b03cxnp08028.gho.boulder.ibm.com (b03cxnp08028.gho.boulder.ibm.com [9.17.130.20]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 677493E40045 for ; Wed, 7 May 2014 15:46:07 -0600 (MDT) Received: from d03av06.boulder.ibm.com (d03av06.boulder.ibm.com [9.17.195.245]) by b03cxnp08028.gho.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s47Lk7ep1573142 for ; Wed, 7 May 2014 23:46:07 +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 s47Lnvi5019478 for ; Wed, 7 May 2014 15:49:57 -0600 Received: from oc2542071013.ibm.com ([9.70.82.177]) by d03av06.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id s47LnuaV019453; Wed, 7 May 2014 15:49:56 -0600 Message-ID: <536AA99E.6070108@linux.vnet.ibm.com> Date: Wed, 07 May 2014 14:46:06 -0700 From: Venkateswararao Jujjuri Reply-To: jvrao@linux.vnet.ibm.com Organization: IBM 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@vger.kernel.org CC: Rong Zeng , Steve Dickson Subject: [PATCH] Adding a callback for incoming sm_notify. X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14050721-3532-0000-0000-000001970423 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 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 Signed-off-by: Venkateswararao Jujjuri " --- utils/statd/callback.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) 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/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) {