Bug 2383585

Summary: remove network-online.target dependency from rpc-statd-notify.service
Product: [Fedora] Fedora Reporter: Dusty Mabe <dustymabe>
Component: nfs-utilsAssignee: Steve Dickson <steved>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 45CC: bcodding, luk.claes, smayhew, steved
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dusty Mabe 2025-07-25 21:13:46 UTC
Can we remove the network-online.target dependency from rpc-statd-notify.service ?

https://git.linux-nfs.org/?p=steved/nfs-utils.git;a=blob;f=systemd/rpc-statd-notify.service;h=962f18b209fa6f84ff6b53712d2dd9cecfc60c73;hb=9f974046c37b7c28705d5558328759fff708b1cb

The man page for sm-notify already mentions:

> Notifications  are retried if sending fails, the remote does not respond, the remote's NSM service is not registered, or if there is a DNS failure which prevents the remote's mon_name from being resolved to an address.

So I would think it would be able to cope with a short period of time if it were to start before Networking were fully online.


The reason I make this request is because in CoreOS/Image Mode we try to keep network-online.target out of the default bootup experience. User's can add their own services that pull it in, but we try not to have it be in there by default.

More context in https://github.com/coreos/fedora-coreos-config/pull/3530#issuecomment-2932405290 and the following comments.

Reproducible: Always

Comment 1 Steve Dickson 2025-07-30 19:18:20 UTC
Here is the reason that was added

ommit 9d4fc3fb5133be2df69fa380f80d1c660827fd1b (tag: nfs-utils-2-1-2-rc2)
Author: Steve Dickson <steved>
Date:   Mon Apr 10 07:16:58 2017 -0400

    systemd: NFS server services should use network-online
    
    There has been an number startup problems where parts of
    the NFS server fails to start due to DNS and other
    parts of the network not be up.
    
    Reading the systemd.special it seems network.target is
    a passive unit which does not wait for the entire
    network to come up and network-online.target is an
    active unit which does wait.
    
    So this adds Wants=network-online.target to all of
    the NFS server services
    
    Signed-off-by: Steve Dickson <steved>

Comment 2 Dusty Mabe 2025-07-30 20:35:34 UTC
ok some more info on why `rpc-statd-notify.service` is of particular interest.
`nfs-client.target` is enabled by default in presets [1]. which means if you have
the NFS packages installed even if you don't configure an NFS client it will get
started. If you are in an offline scenario (one example is an install environment)
network-online.target is still getting pulled in by default so you have to wait
for that to timeout before you can get to the system.


The proposal here is to remove `Wants=network-online.target` from `rpc-statd-notify.service`.
In the case where other things pull in network-online.target then the 
`After=local-fs.target network-online.target nss-lookup.target` still exists
and `rpc-statd-notify.service` will wait. In the case where nothing else
pulls in `network-online.target` then `sm-notify` will start possibly before
netowrking is up, but it will retry:

```
Notifications are retried if sending fails, the remote does not respond, the remote's  NSM  ser‐
vice  is  not registered, or if there is a DNS failure which prevents the remote's mon_name from
being resolved to an address.
```

In a completely offline scenario, well the box probably didn't have any NFS client
mounts anyway, but in this case sm-notify will eventually timeout, but at least the
systemd service won't be marked as failed because:

```
ExecStart=-/usr/sbin/sm-notify
```

and

```
├────────┼──────────────────────────────────────────┤
│ "-"    │ If the executable path is prefixed with  │
│        │ "-", an exit code of the command         │
│        │ normally considered a failure (i.e.      │
│        │ non-zero exit status or abnormal exit    │
│        │ due to signal) is recorded, but has no   │
│        │ further effect and is considered         │
│        │ equivalent to success.                   │
├────────┼──────────────────────────────────────────┤
```


[1] https://src.fedoraproject.org/rpms/fedora-release/blob/68abb19e666e0872d61f5dc698931172101e94d4/f/90-default.preset#_451

Comment 3 Dusty Mabe 2025-07-30 20:39:17 UTC
And to show the dependency nfs-client.target/rpc-statd-notify.service/network-online.target dependency:

```
[core@cosa-devsh ~]$ systemctl list-dependencies --reverse network-online.target
network-online.target
○ ├─docker.service
○ ├─fwupd-refresh.service
○ ├─iscsi.service
○ ├─nfs-idmapd.service
○ ├─nfs-mountd.service
○ ├─nfs-server.service
● ├─rpc-statd-notify.service
○ └─rpc-statd.service
[core@cosa-devsh ~]$ 
[core@cosa-devsh ~]$ systemctl list-dependencies --reverse rpc-statd-notify.service
rpc-statd-notify.service
○ ├─nfs-server.service
○ ├─nfs-utils.service
○ ├─rpc-statd.service
● └─nfs-client.target
●   ├─multi-user.target
○   │ └─graphical.target
●   └─remote-fs.target
○     ├─dracut-pre-pivot.service
●     └─multi-user.target
○       └─graphical.target
```

Comment 4 Benjamin Coddington 2025-08-08 12:18:10 UTC
Probably would be a good idea to test this proposed change - does sm-notify indeed properly send the reboot notification when the network finally arrives?

Also, you could probably take the discussion for this change upstream - Steve D as maintainer is the person to convince.

Comment 5 Dusty Mabe 2025-08-08 13:02:24 UTC
Thanks Benjamin for responding! 

> (In reply to Benjamin Coddington from comment #4)
> Probably would be a good idea to test this proposed change - does sm-notify
> indeed properly send the reboot notification when the network finally
> arrives?

Good suggestion. I was hoping NFS had some automated test framework we could
run the change through. If not I can try to test manually, but I will
admit I am not an NFS expert. I'd like for my steps and results to be corroborated
by someone who knows what they are doing.


> Also, you could probably take the discussion for this change upstream -
> Steve D as maintainer is the person to convince.

Yep. I've engaged with Steve.

Steve is there an upstream place you'd like me to send this proposal?

Comment 6 Scott Mayhew 2025-08-08 13:43:43 UTC
The commit that SteveD referenced in comment #1 was for https://bugzilla.redhat.com/show_bug.cgi?id=1409012, so you'll need to ensure that making that change doesn't cause a regression.

Comment 7 Dusty Mabe 2025-08-10 13:50:08 UTC
Hey Scott,

I'll have to run some tests to confirm, but you can see from the output in
https://bugzilla.redhat.com/show_bug.cgi?id=2383585#c3 that `nfs-server.service`
(if enabled) depends on `network-online.target` directly so I don't think there's
any risk of nfs-server not waiting for network-online.target.

Comment 8 Steve Dickson 2025-08-11 10:23:55 UTC
(In reply to Dusty Mabe from comment #5)
> 
> Steve is there an upstream place you'd like me to send this proposal?
Yes... I will work with you to get a patch sent upstream (linux-nfs.org)

Comment 9 Steve Dickson 2026-01-22 22:05:57 UTC
Here is how I  send a patch(s) upstream...

git clone git://linux-nfs.org/~steved/nfs-utils
cd nfs-utils/
Edit file(s) to the changes
./autogen.sh # to create the configure file
./configure # to create the Makefile(s)
make -j  # to make sure things compile
git commit -s -a # to commit the changes 
git format-patch -o /tmp -1 # or the number of patches 
# which put the patch(s) in /tmp

git send-email "--dry-run" --suppress-cc=all --suppress-from --no-chain-reply-to \
--from "Your Name <Your Email>" \
--to "Linux NFS Mailing list <linux-nfs.org>" \
/tmp/*.patch

# Note "--dry-run" is so you test the sending before
  you posted the patch(s)

Comment 10 Dusty Mabe 2026-01-23 14:37:16 UTC
posted up https://lore.kernel.org/linux-nfs/20260123143503.1342968-1-dusty@dustymabe.com/T/#u

I skipped the compile steps since this patch is literally just a systemd unit change. Hope that is OK.

Comment 11 Aoife Moloney 2026-08-17 13:55:03 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 45 development cycle.
Changing version to 45.