* [PATCH nfs-utils 0/2] Fix problems caused by rpc.statd being unresponsive. @ 2015-12-17 4:27 NeilBrown 2015-12-17 4:27 ` [PATCH 1/2] mount.nfs: trust the exit status of "start_statd" NeilBrown ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: NeilBrown @ 2015-12-17 4:27 UTC (permalink / raw) To: Steve Dickson; +Cc: linux-nfs If rpc.statd is temporarily unresponsive (e.g. because DNS service is slow) it can cause mount attempts to fail inappropriately or can cause multiple rpc.statd processes to be running on the one machine. These patches address those problems. --- NeilBrown (2): mount.nfs: trust the exit status of "start_statd". start-statd: don't run multiple rpc.statds on the one host. utils/mount/network.c | 6 +++++- utils/statd/start-statd | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) -- Signature ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] mount.nfs: trust the exit status of "start_statd". 2015-12-17 4:27 [PATCH nfs-utils 0/2] Fix problems caused by rpc.statd being unresponsive NeilBrown @ 2015-12-17 4:27 ` NeilBrown 2015-12-17 4:27 ` [PATCH 2/2] start-statd: don't run multiple rpc.statds on the one host NeilBrown 2016-01-16 21:58 ` [PATCH nfs-utils 0/2] Fix problems caused by rpc.statd being unresponsive Steve Dickson 2 siblings, 0 replies; 4+ messages in thread From: NeilBrown @ 2015-12-17 4:27 UTC (permalink / raw) To: Steve Dickson; +Cc: linux-nfs 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 <neilb@suse.com> --- utils/mount/network.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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) { ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] start-statd: don't run multiple rpc.statds on the one host. 2015-12-17 4:27 [PATCH nfs-utils 0/2] Fix problems caused by rpc.statd being unresponsive NeilBrown 2015-12-17 4:27 ` [PATCH 1/2] mount.nfs: trust the exit status of "start_statd" NeilBrown @ 2015-12-17 4:27 ` NeilBrown 2016-01-16 21:58 ` [PATCH nfs-utils 0/2] Fix problems caused by rpc.statd being unresponsive Steve Dickson 2 siblings, 0 replies; 4+ messages in thread From: NeilBrown @ 2015-12-17 4:27 UTC (permalink / raw) To: Steve Dickson; +Cc: linux-nfs 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 <neilb@suse.com> --- utils/statd/start-statd | 8 ++++++++ 1 file changed, 8 insertions(+) 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 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH nfs-utils 0/2] Fix problems caused by rpc.statd being unresponsive. 2015-12-17 4:27 [PATCH nfs-utils 0/2] Fix problems caused by rpc.statd being unresponsive NeilBrown 2015-12-17 4:27 ` [PATCH 1/2] mount.nfs: trust the exit status of "start_statd" NeilBrown 2015-12-17 4:27 ` [PATCH 2/2] start-statd: don't run multiple rpc.statds on the one host NeilBrown @ 2016-01-16 21:58 ` Steve Dickson 2 siblings, 0 replies; 4+ messages in thread From: Steve Dickson @ 2016-01-16 21:58 UTC (permalink / raw) To: NeilBrown; +Cc: linux-nfs On 12/16/2015 11:27 PM, NeilBrown wrote: > If rpc.statd is temporarily unresponsive (e.g. because DNS service is > slow) it can cause mount attempts to fail inappropriately or can cause > multiple rpc.statd processes to be running on the one machine. > > These patches address those problems. > > --- > > NeilBrown (2): > mount.nfs: trust the exit status of "start_statd". > start-statd: don't run multiple rpc.statds on the one host. Both patches committed.... again.. thank you! steved > > > utils/mount/network.c | 6 +++++- > utils/statd/start-statd | 8 ++++++++ > 2 files changed, 13 insertions(+), 1 deletion(-) > > -- > Signature > > -- > 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 > ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-01-16 21:58 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-12-17 4:27 [PATCH nfs-utils 0/2] Fix problems caused by rpc.statd being unresponsive NeilBrown 2015-12-17 4:27 ` [PATCH 1/2] mount.nfs: trust the exit status of "start_statd" NeilBrown 2015-12-17 4:27 ` [PATCH 2/2] start-statd: don't run multiple rpc.statds on the one host NeilBrown 2016-01-16 21:58 ` [PATCH nfs-utils 0/2] Fix problems caused by rpc.statd being unresponsive Steve Dickson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).