Bug 1191920

Summary: [nfs service] "service nfs reload-or-try-restart (force-reload)" failed after "service nfs stop"
Product: Red Hat Enterprise Linux 7 Reporter: Yongcheng Yang <yoyang>
Component: systemdAssignee: Jan Synacek <jsynacek>
Status: CLOSED ERRATA QA Contact: Frantisek Sumsal <fsumsal>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: fsumsal, glamb, jaster, joerg.kastning, jsynacek, lnykryn, msekleta, nikolai.kondrashov, systemd-maint-list, systemd-maint, xzhou, yoyang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: systemd-219-58.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-30 11:32:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1269194, 1365226, 1383699, 1393867, 1400961, 1420851, 1466365, 1472751, 1549617, 1551061    

Description Yongcheng Yang 2015-02-12 09:09:59 UTC
Description of problem:
systemctl nfs reload-or-try-restart (service nfs force-reload) return fail if the nfs service is not running. 
For the option "reload-or-try-restart/force-reload" is to "Reload one or more units if they support it. If not, restart them instead. This does nothing if the units are not running" from the systemctl man page.

Version-Release number of selected component (if applicable):
RHEL-7.1

How reproducible:
100%

Steps to Reproduce:
1.service nfs stop
2.service nfs force-reload

Actual results:
[root@hp-dl580g7-03 tools]# service nfs stop
Redirecting to /bin/systemctl stop  nfs.service
                           ^^^^^^^^^ stop the nfs service
[root@hp-dl580g7-03 tools]# service nfs reload-or-try-restart
Redirecting to /bin/systemctl reload-or-try-restart  nfs.service
Job for nfs-server.service failed. See 'systemctl status nfs-server.service' and 'journalctl -xn' for details.
[root@hp-dl580g7-03 tools]# echo $?
1
[root@hp-dl580g7-03 tools]# 
[root@hp-dl580g7-03 tools]# service nfs force-reload
Redirecting to /bin/systemctl force-reload  nfs.service
Job for nfs-server.service failed. See 'systemctl status nfs-server.service' and 'journalctl -xn' for details.
[root@hp-dl580g7-03 tools]# echo $?
1
^^ then the "force-reload" option got failed
[root@hp-dl580g7-03 tools]# journalctl -xn
-- Logs begin at Thu 2015-02-12 16:12:35 CST, end at Thu 2015-02-12 16:48:38 CST. --
Feb 12 16:48:26 hp-dl580g7-03.rhts.eng.nay.redhat.com systemd[1]: Stopping NFS server and services...
-- Subject: Unit nfs-server.service has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit nfs-server.service has begun shutting down.
Feb 12 16:48:26 hp-dl580g7-03.rhts.eng.nay.redhat.com systemd[1]: Stopped NFS server and services.
-- Subject: Unit nfs-server.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit nfs-server.service has finished shutting down.
Feb 12 16:48:26 hp-dl580g7-03.rhts.eng.nay.redhat.com systemd[1]: Stopping NFSv4 ID-name mapping service...
-- Subject: Unit nfs-idmapd.service has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit nfs-idmapd.service has begun shutting down.
Feb 12 16:48:26 hp-dl580g7-03.rhts.eng.nay.redhat.com systemd[1]: Stopping NFS Mount Daemon...
-- Subject: Unit nfs-mountd.service has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit nfs-mountd.service has begun shutting down.
Feb 12 16:48:26 hp-dl580g7-03.rhts.eng.nay.redhat.com systemd[1]: Stopped NFSv4 ID-name mapping service.
-- Subject: Unit nfs-idmapd.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit nfs-idmapd.service has finished shutting down.
Feb 12 16:48:26 hp-dl580g7-03.rhts.eng.nay.redhat.com rpc.mountd[17119]: Caught signal 15, un-registering and exiting.
Feb 12 16:48:26 hp-dl580g7-03.rhts.eng.nay.redhat.com systemd[1]: Stopped NFS Mount Daemon.
-- Subject: Unit nfs-mountd.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit nfs-mountd.service has finished shutting down.
Feb 12 16:48:26 hp-dl580g7-03.rhts.eng.nay.redhat.com kernel: nfsd: last server has exited, flushing export cache
Feb 12 16:48:29 hp-dl580g7-03.rhts.eng.nay.redhat.com systemd[1]: Unit nfs-server.service cannot be reloaded because it is inactive.
Feb 12 16:48:38 hp-dl580g7-03.rhts.eng.nay.redhat.com systemd[1]: Unit nfs-server.service cannot be reloaded because it is inactive.
[root@hp-dl580g7-03 tools]# service nfs reload
Redirecting to /bin/systemctl reload  nfs.service
Job for nfs-server.service failed. See 'systemctl status nfs-server.service' and 'journalctl -xn' for details.
[root@hp-dl580g7-03 tools]# echo $?
1
[root@hp-dl580g7-03 tools]# service nfs restart     
Redirecting to /bin/systemctl restart  nfs.service
[root@hp-dl580g7-03 tools]# service nfs force-reload
Redirecting to /bin/systemctl force-reload  nfs.service
                    ^^^^^^^^^^^^^^^^^^^^^^^ it's OK if the nfs is running
[root@hp-dl580g7-03 tools]# echo $?
0
[root@hp-dl580g7-03 tools]# service nfs reload
Redirecting to /bin/systemctl reload  nfs.service
[root@hp-dl580g7-03 tools]# echo $?
0
[root@hp-dl580g7-03 tools]# 


Expected results:
The "reload-or-try-restart/force-reload" option does nothing when the nfs service is not running.

Additional info:
This act the same on both rhel-7.0 and rhel-7.0 but not reprodoced on rhel6

Comment 1 Yongcheng Yang 2015-02-12 09:14:12 UTC
What it act on RHEL6:
[root@hp-dl380pg8-09 nfs]# service nfs status
rpc.svcgssd is stopped
rpc.mountd (pid 8288) is running...
nfsd (pid 8304 8303 8302 8301 8300 8299 8298 8297) is running...
rpc.rquotad (pid 8283) is running...
[root@hp-dl380pg8-09 nfs]# service nfs force-reload
[root@hp-dl380pg8-09 nfs]# echo $?
0
[root@hp-dl380pg8-09 nfs]# uname -r
2.6.32-504.el6.x86_64
[root@hp-dl380pg8-09 nfs]# service nfs start
[root@hp-dl380pg8-09 nfs]# service nfs force-reload
[root@hp-dl380pg8-09 nfs]# echo $?
0
[root@hp-dl380pg8-09 nfs]#

Comment 3 Steve Dickson 2015-07-29 10:21:46 UTC
Please retest with update systemd scripts.

Comment 4 Yongcheng Yang 2015-07-30 05:47:25 UTC
(In reply to Steve Dickson from comment #3)
> Please retest with update systemd scripts.

Still can be reproduced with nfs-utils-1.3.0-0.13.el7.x86_64 kernel-3.10.0-295.el7.x86_64 (RHEL-7.2-20150720.0)

[root@hp-dl385pg8-03 ~]# service nfs stop
Redirecting to /bin/systemctl stop  nfs.service
[root@hp-dl385pg8-03 ~]# echo $?
0
[root@hp-dl385pg8-03 ~]# service nfs force-reload
Redirecting to /bin/systemctl force-reload  nfs.service
Job for nfs-server.service invalid.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Failed
[root@hp-dl385pg8-03 ~]# echo $?
1
[root@hp-dl385pg8-03 ~]# service nfs status -l
Redirecting to /bin/systemctl status  -l nfs.service
● nfs-server.service - NFS server and services
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; vendor preset: disabled)
   Active: inactive (dead) since Thu 2015-07-30 13:41:14 CST; 2min 37s ago
  Process: 17234 ExecStopPost=/usr/sbin/exportfs -f (code=exited, status=0/SUCCESS)
  Process: 17231 ExecStopPost=/usr/sbin/exportfs -au (code=exited, status=0/SUCCESS)
  Process: 17229 ExecStop=/usr/sbin/rpc.nfsd 0 (code=exited, status=0/SUCCESS)
  Process: 17157 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
  Process: 17155 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
 Main PID: 17157 (code=exited, status=0/SUCCESS)

Jul 30 13:41:13 hp-dl385pg8-03.rhts.eng.nay.redhat.com systemd[1]: Starting NFS server and services...
Jul 30 13:41:13 hp-dl385pg8-03.rhts.eng.nay.redhat.com systemd[1]: Started NFS server and services.
Jul 30 13:41:14 hp-dl385pg8-03.rhts.eng.nay.redhat.com systemd[1]: Stopping NFS server and services...
Jul 30 13:41:14 hp-dl385pg8-03.rhts.eng.nay.redhat.com systemd[1]: Stopped NFS server and services.
Jul 30 13:43:07 hp-dl385pg8-03.rhts.eng.nay.redhat.com systemd[1]: Stopped NFS server and services.
Jul 30 13:43:12 hp-dl385pg8-03.rhts.eng.nay.redhat.com systemd[1]: Unit nfs-server.service cannot be reloaded because it is inactive.
Jul 30 13:43:34 hp-dl385pg8-03.rhts.eng.nay.redhat.com systemd[1]: Stopped NFS server and services.
Jul 30 13:43:39 hp-dl385pg8-03.rhts.eng.nay.redhat.com systemd[1]: Unit nfs-server.service cannot be reloaded because it is inactive.
[root@hp-dl385pg8-03 ~]# service nfs start
Redirecting to /bin/systemctl start  nfs.service
[root@hp-dl385pg8-03 ~]# service nfs force-reload
Redirecting to /bin/systemctl force-reload  nfs.service
[root@hp-dl385pg8-03 ~]# echo $?
0
[root@hp-dl385pg8-03 ~]# service nfs status -l
Redirecting to /bin/systemctl status  -l nfs.service
● nfs-server.service - NFS server and services
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; vendor preset: disabled)
   Active: active (exited) since Thu 2015-07-30 13:43:59 CST; 8s ago
  Process: 17234 ExecStopPost=/usr/sbin/exportfs -f (code=exited, status=0/SUCCESS)
  Process: 17231 ExecStopPost=/usr/sbin/exportfs -au (code=exited, status=0/SUCCESS)
  Process: 17229 ExecStop=/usr/sbin/rpc.nfsd 0 (code=exited, status=0/SUCCESS)
  Process: 17499 ExecReload=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
  Process: 17465 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
  Process: 17463 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
 Main PID: 17465 (code=exited, status=0/SUCCESS)

Jul 30 13:43:59 hp-dl385pg8-03.rhts.eng.nay.redhat.com systemd[1]: Starting NFS server and services...
Jul 30 13:43:59 hp-dl385pg8-03.rhts.eng.nay.redhat.com systemd[1]: Started NFS server and services.
Jul 30 13:44:01 hp-dl385pg8-03.rhts.eng.nay.redhat.com systemd[1]: Reloaded NFS server and services.
[root@hp-dl385pg8-03 ~]#

Comment 5 Steve Dickson 2015-07-30 15:42:29 UTC
(In reply to Yongcheng Yang from comment #4)
> (In reply to Steve Dickson from comment #3)
> > Please retest with update systemd scripts.
> 
> Still can be reproduced with nfs-utils-1.3.0-0.13.el7.x86_64
> kernel-3.10.0-295.el7.x86_64 (RHEL-7.2-20150720.0)
> 
> [root@hp-dl385pg8-03 ~]# service nfs stop
> Redirecting to /bin/systemctl stop  nfs.service
> [root@hp-dl385pg8-03 ~]# echo $?
> 0
> [root@hp-dl385pg8-03 ~]# service nfs force-reload
> Redirecting to /bin/systemctl force-reload  nfs.service
> Job for nfs-server.service invalid.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Failed
It works just fine for me
rhel7# /bin/systemctl force-reload  nfs.service
rhel7# /bin/systemctl force-reload  nfs-server


also, what exactly is this test testing?

Comment 6 Yongcheng Yang 2015-07-31 04:28:05 UTC
(In reply to Steve Dickson from comment #5)
> (In reply to Yongcheng Yang from comment #4)
> > (In reply to Steve Dickson from comment #3)
> > > Please retest with update systemd scripts.
> > 
> > Still can be reproduced with nfs-utils-1.3.0-0.13.el7.x86_64
> > kernel-3.10.0-295.el7.x86_64 (RHEL-7.2-20150720.0)
> > 
> > [root@hp-dl385pg8-03 ~]# service nfs stop
> > Redirecting to /bin/systemctl stop  nfs.service
> > [root@hp-dl385pg8-03 ~]# echo $?
> > 0
> > [root@hp-dl385pg8-03 ~]# service nfs force-reload
> > Redirecting to /bin/systemctl force-reload  nfs.service
> > Job for nfs-server.service invalid.
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Failed
> It works just fine for me
> rhel7# /bin/systemctl force-reload  nfs.service
> rhel7# /bin/systemctl force-reload  nfs-server
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
please sop the nfs.service, and then test using the above "force-reload" command

> 
> 
> also, what exactly is this test testing?
Test the force-reload when the nfs.service is not running.

And from man page of systemctl(1):
reload-or-restart PATTERN...
           Reload one or more units if they support it. 
           If not, restart them instead. If the units are
           not running yet, they will be started.

Comment 7 Steve Dickson 2015-07-31 16:08:24 UTC
(In reply to Yongcheng Yang from comment #6)
> (In reply to Steve Dickson from comment #5)
> > It works just fine for me
> > rhel7# /bin/systemctl force-reload  nfs.service
> > rhel7# /bin/systemctl force-reload  nfs-server
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
> please sop the nfs.service, and then test using the above "force-reload"
> command
Ok I see the error:

# systemctl stop nfs
# systemctl force-reload nfs
Job for nfs-server.service invalid.

> 
> > 
> > 
> > also, what exactly is this test testing?
> Test the force-reload when the nfs.service is not running.
> 
> And from man page of systemctl(1):
> reload-or-restart PATTERN...
>            Reload one or more units if they support it. 
>            If not, restart them instead. If the units are
>            not running yet, they will be started.
systemctl -l status nfs reports
  Unit nfs-server.service cannot be reloaded because it is inactive

and when nfsd is loaded things work just fine
# systemctl start nfs
# systemctl force-reload nfs

So I'm thinking that manpage is wrong when it talks about
restarting the unit...

Comment 9 Lukáš Nykrýn 2016-10-11 11:18:18 UTC
Problem here is that the reload action is designed for the running daemons, it basically means that it should reload its configuration. 

nfs-server is not a daemon, it is oneshot service (with RemainAfterExit=yes) and to be honest I am quite surprised that reload action are allowed there at all.

I will reassign this to systemd, we need to look what we should do in those cases.

Comment 13 Nikolai Kondrashov 2017-06-20 10:52:01 UTC
I believe this was discussed upstream and fixed in v229:

    https://github.com/systemd/systemd/issues/688

Comment 18 Jan Synacek 2018-05-28 11:26:26 UTC
https://github.com/lnykryn/systemd-rhel/pull/209

Comment 20 Lukáš Nykrýn 2018-06-20 08:50:41 UTC
fix merged to staging branch -> https://github.com/lnykryn/systemd-rhel/pull/209 -> post

Comment 27 errata-xmlrpc 2018-10-30 11:32:10 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:3245

Comment 28 Alex Scheel 2019-07-24 16:49:10 UTC
*** Bug 1365226 has been marked as a duplicate of this bug. ***

Comment 29 Plumber Bot 2022-01-21 15:38:31 UTC
Dropping the stale needinfo. If our input is still needed, please set the needinfo again.