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: 7869371 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 E4594BEEE5 for ; Thu, 17 Dec 2015 04:28:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 15786203E1 for ; Thu, 17 Dec 2015 04:28:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 33C55203B8 for ; Thu, 17 Dec 2015 04:28:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752659AbbLQE20 (ORCPT ); Wed, 16 Dec 2015 23:28:26 -0500 Received: from mx2.suse.de ([195.135.220.15]:38083 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751242AbbLQE2I (ORCPT ); Wed, 16 Dec 2015 23:28:08 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id EB092AC43; Thu, 17 Dec 2015 04:28:06 +0000 (UTC) From: NeilBrown To: Steve Dickson Date: Thu, 17 Dec 2015 15:27:34 +1100 Subject: [PATCH 1/2] mount.nfs: trust the exit status of "start_statd". Cc: linux-nfs@vger.kernel.org Message-ID: <20151217042734.7581.35502.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 DNS service is particularly slow, nfs_probe_statd() can fail even though rpc.statd is actually running. This happens because rpc.statd is single threaded and could be waiting longer for DNS than nfs_probe_statd() will wait for it. This causes problems when mount.nfs uses nfs_probe_statd() to see if statd is running, as is needed for NFSv3. Currently in these circumstances there are two possible outcomes. 1/ if systemd is in use, it will be told to start rpc-statd, which is already running so no change. mount.nfs will try pinging rpc.statd a few more times and could eventually give up and fail the mount. While slow DNS may well result in slow service, it shouldn't cause a mount attempt to fail. 2/ if systemd is not in use, a new rpc.statd will be started. This can (and has) lead to a large number of rpc.statd processes running on the one machine. This patch addresses the first scenario. If START_STATD is run and exits with a success status, mount.nfs assumes statd is running and allows the mount to succeed. A separate patch will address the other scenario. Signed-off-by: NeilBrown --- utils/mount/network.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 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/mount/network.c b/utils/mount/network.c index 8a9bf1476d51..7240ca7bcdc4 100644 --- a/utils/mount/network.c +++ b/utils/mount/network.c @@ -794,6 +794,7 @@ int start_statd(void) if (stat(START_STATD, &stb) == 0) { if (S_ISREG(stb.st_mode) && (stb.st_mode & S_IXUSR)) { int cnt = STATD_TIMEOUT * 10; + int status = 0; const struct timespec ts = { .tv_sec = 0, .tv_nsec = 100000000, @@ -808,7 +809,10 @@ int start_statd(void) progname, strerror(errno)); break; default: /* parent */ - waitpid(pid, NULL,0); + if (waitpid(pid, &status,0) == pid && + status == 0) + /* assume it worked */ + return 1; break; } while (1) {