From patchwork Thu Dec 17 04:27:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 7869381 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E9429BEEE5 for ; Thu, 17 Dec 2015 04:28:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2319D203E1 for ; Thu, 17 Dec 2015 04:28:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 486BA203B8 for ; Thu, 17 Dec 2015 04:28:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751242AbbLQE21 (ORCPT ); Wed, 16 Dec 2015 23:28:27 -0500 Received: from mx2.suse.de ([195.135.220.15]:38091 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752201AbbLQE2O (ORCPT ); Wed, 16 Dec 2015 23:28:14 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 0248AAC43; Thu, 17 Dec 2015 04:28:13 +0000 (UTC) From: NeilBrown To: Steve Dickson Date: Thu, 17 Dec 2015 15:27:34 +1100 Subject: [PATCH 2/2] start-statd: don't run multiple rpc.statds on the one host. Cc: linux-nfs@vger.kernel.org Message-ID: <20151217042734.7581.45571.stgit@noble> In-Reply-To: <20151217042613.7581.1566.stgit@noble> References: <20151217042613.7581.1566.stgit@noble> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, 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 If rpc.statd is running but slow to respond, mount.nfs will run "start-statd" which might start a new statd. This is not a good ideas as can result in lots of rpc.statds. So inf start-statd check the pid file and if rpc.statd seems to be running, exit with success. (also "cd /" before running rpc.statd, just in case). Signed-off-by: NeilBrown --- utils/statd/start-statd | 8 ++++++++ 1 file changed, 8 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/utils/statd/start-statd b/utils/statd/start-statd index 14369e515cb2..19e6eb21d044 100755 --- a/utils/statd/start-statd +++ b/utils/statd/start-statd @@ -6,11 +6,19 @@ # site. PATH="/sbin:/usr/sbin:/bin:/usr/bin" +if [ -s /var/run/rpc.statd.pid ] && + [ 1`cat /var/run/rpc.statd.pid` -gt 1 ] && + kill -0 `cat /var/run/rpc.statd.pid` > /dev/null 2>&1 +then + # statd already running - must have been slow to respond. + exit 0 +fi # First try systemd if it's installed. if [ -d /run/systemd/system ]; then # Quit only if the call worked. systemctl start rpc-statd.service && exit fi +cd / # Fall back to launching it ourselves. exec rpc.statd --no-notify