Skip to contentSkip to conversation

rpcbind.service: Not pulling the rpcbind.target

PATCH Superseded Steve Dickson 3 participants 6 messages Dec 14, 2017

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rpcbind.service: Not pulling the rpcbind.target

According to systemd.special(7) manpage:

rpcbind.target
The portmapper/rpcbind pulls in this target and orders itself before it, to indicate its availability. systemd automatically adds dependencies of type After= for this target unit to all SysV init script service units with an LSB header referring to the "$portmap" facility.

---
 systemd/rpcbind.service.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
systemd/rpcbind.service.in +2 -2
index f8cfa9f..2b49c24 100644
@@ -6,8 +6,8 @@ RequiresMountsFor=@statedir@
 
 # Make sure we use the IP addresses listed for
 # rpcbind.socket, no matter how this unit is started.
-Wants=rpcbind.socket
-After=rpcbind.socket
+Wants=rpcbind.socket rpcbind.target
+After=rpcbind.socket rpcbind.target
 
 [Service]
 Type=notify
Signature · 1 line
2.14.3
#1 lore raw
Quoted 15 lines · Steve Dickson

According to systemd.special(7) manpage:

rpcbind.target
The portmapper/rpcbind pulls in this target and orders itself
before it, to indicate its availability. systemd automatically adds dependencies of type After= for this target unit to all SysV init script service units with an LSB header referring to the "$portmap" facility.

systemd/rpcbind.service.in +0 -0
index f8cfa9f..2b49c24 100644

systemd/rpcbind.service.in RequiresMountsFor=@statedir@ · line 10

Quoted 7 lines
systemd/rpcbind.service.in +2 -2
@@ -6,8 +6,8 @@ RequiresMountsFor=@statedir@
 
 # Make sure we use the IP addresses listed for
 # rpcbind.socket, no matter how this unit is started.
-Wants=rpcbind.socket
-After=rpcbind.socket
+Wants=rpcbind.socket rpcbind.target
+After=rpcbind.socket rpcbind.target

Is this needed when the service has socket activation support? If the only interaction with it is through the socket, it shouldn't matter even if the service is not actually up yet - clients can already open connections to the socket regardless.

And regardless, that "After" for rpcbind.target seems backwards. Shouldn't it be "Before", so that the target being up signals that the service has already been started?

Not directly related, but if that comment is accurate and the socket should be used "no matter what", perhaps that should be "Requires" instead of "Wants" so that if the socket could not be opened for some reason, the service fails instead of starting without socket activation?

#2 lore raw
Quoted 17 lines · Uoti Urpala
Quoted 16 lines · Steve Dickson

According to systemd.special(7) manpage:

rpcbind.target
The portmapper/rpcbind pulls in this target and orders itself
before it, to indicate its availability. systemd automatically adds dependencies of type After= for this target unit to all SysV init script service units with an LSB header referring to the "$portmap" facility.

systemd/rpcbind.service.in +0 -0
index f8cfa9f..2b49c24 100644
@@ -6,8 +6,8 @@ RequiresMountsFor=@statedir@
 
Quoted 11 lines

systemd/rpcbind.service.in RequiresMountsFor=@statedir@ · line 10

Quoted 6 lines
systemd/rpcbind.service.in +2 -2
 # Make sure we use the IP addresses listed for
 # rpcbind.socket, no matter how this unit is started.
-Wants=rpcbind.socket
-After=rpcbind.socket
+Wants=rpcbind.socket rpcbind.target
+After=rpcbind.socket rpcbind.target

Is this needed when the service has socket activation support? If the only interaction with it is through the socket, it shouldn't matter even if the service is not actually up yet - clients can already open connections to the socket regardless.

Well things are working as is... but this man page paragraph was pointed out to me so I though these Wants and After were needed.

So you saying this patch is not needed?

Quoted 4 lines

And regardless, that "After" for rpcbind.target seems backwards. Shouldn't it be "Before", so that the target being up signals that the service has already been started?

I think this makes sense... So if the patch is needed I'll add Before=rpcbind.target and remove the target from the After=

Quoted 7 lines

Not directly related, but if that comment is accurate and the socket should be used "no matter what", perhaps that should be "Requires" instead of "Wants" so that if the socket could not be opened for some reason, the service fails instead of starting without socket activation?

I was afraid of opening a can a worms here... :-)

So you are saying Wants and After should be changed to

Requires=rpcbind.socket
Before=rpcbind.target

steved

#3 lore raw
Quoted 11 lines · Steve Dickson
Quoted 8 lines · Uoti Urpala

systemd/rpcbind.service.in RequiresMountsFor=@statedir@ · line 10

Quoted 2 lines · Steve Dickson
systemd/rpcbind.service.in +2 -0
+Wants=rpcbind.socket rpcbind.target
+After=rpcbind.socket rpcbind.target

Is this needed when the service has socket activation support? If the only interaction with it is through the socket, it shouldn't matter even if the service is not actually up yet - clients can already open connections to the socket regardless.

Quoted 4 lines

Well things are working as is... but this man page paragraph was pointed out to me so I though these Wants and After were needed.

So you saying this patch is not needed?

I'm not familiar enough with rpcbind stuff to say with certainty that it wouldn't be needed, but at least it seems plausible to me that it would not be. The mechanism described on the man page is a way to implement ordering if needed, but if the early availability of the socket means ordering is never an issue, then it can be ignored.

Quoted 6 lines
Quoted 3 lines

And regardless, that "After" for rpcbind.target seems backwards. Shouldn't it be "Before", so that the target being up signals that the service has already been started?

I think this makes sense... So if the patch is needed I'll add Before=rpcbind.target and remove the target from the After=

Yes.

Quoted 7 lines
Quoted 6 lines

Not directly related, but if that comment is accurate and the socket should be used "no matter what", perhaps that should be "Requires" instead of "Wants" so that if the socket could not be opened for some reason, the service fails instead of starting without socket activation?

Quoted 6 lines

I was afraid of opening a can a worms here... :-)

So you are saying Wants and After should be changed to

Requires=rpcbind.socket
Before=rpcbind.target

Depends on the exact semantics you want. "Wants" means that systemd will try to start the socket if the service is started, but will continue with the service start even if the dependency fails. "Requires" guarantees that the service will never be started without the socket active - if opening the socket fails, then the service start will return failure too. If you know that the socket unit should always be used, or the service will either fail or do the wrong thing without it (such as open a socket with parameters different from what was configured for the socket unit, and which the admin didn't expect) then
Requires may be more appropriate.

#4 lore raw
Quoted 47 lines · Uoti Urpala
Quoted 11 lines · Steve Dickson
Quoted 8 lines · Uoti Urpala

systemd/rpcbind.service.in RequiresMountsFor=@statedir@ · line 10

Quoted 2 lines · Steve Dickson
systemd/rpcbind.service.in +2 -0
+Wants=rpcbind.socket rpcbind.target
+After=rpcbind.socket rpcbind.target

Is this needed when the service has socket activation support? If the only interaction with it is through the socket, it shouldn't matter even if the service is not actually up yet - clients can already open connections to the socket regardless.

Quoted 4 lines

Well things are working as is... but this man page paragraph was pointed out to me so I though these Wants and After were needed.

So you saying this patch is not needed?

I'm not familiar enough with rpcbind stuff to say with certainty that it wouldn't be needed, but at least it seems plausible to me that it would not be. The mechanism described on the man page is a way to implement ordering if needed, but if the early availability of the socket means ordering is never an issue, then it can be ignored.

Quoted 6 lines
Quoted 3 lines

And regardless, that "After" for rpcbind.target seems backwards. Shouldn't it be "Before", so that the target being up signals that the service has already been started?

I think this makes sense... So if the patch is needed I'll add Before=rpcbind.target and remove the target from the After=

Yes.

Quoted 7 lines
Quoted 6 lines

Not directly related, but if that comment is accurate and the socket should be used "no matter what", perhaps that should be "Requires" instead of "Wants" so that if the socket could not be opened for some reason, the service fails instead of starting without socket activation?

Quoted 6 lines

I was afraid of opening a can a worms here... :-)

So you are saying Wants and After should be changed to

Requires=rpcbind.socket
Before=rpcbind.target

Quoted 10 lines

Depends on the exact semantics you want. "Wants" means that systemd will try to start the socket if the service is started, but will continue with the service start even if the dependency fails. "Requires" guarantees that the service will never be started without the socket active - if opening the socket fails, then the service start will return failure too. If you know that the socket unit should always be used, or the service will either fail or do the wrong thing without it (such as open a socket with parameters different from what was configured for the socket unit, and which the admin didn't expect) then
Requires may be more appropriate.

I think I agree with you... thanks!

steved.

Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw
In reply to Steve Dickson
Quoted 19 lines · Steve Dickson

According to systemd.special(7) manpage:

rpcbind.target
The portmapper/rpcbind pulls in this target and orders itself before it, to indicate its availability. systemd automatically adds dependencies of type After= for this target unit to all SysV init script service units with an LSB header referring to the "$portmap" facility.

---
 systemd/rpcbind.service.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
systemd/rpcbind.service.in +0 -0
index f8cfa9f..2b49c24 100644

systemd/rpcbind.service.in RequiresMountsFor=@statedir@ · line 10

Quoted 7 lines
systemd/rpcbind.service.in +2 -2
@@ -6,8 +6,8 @@ RequiresMountsFor=@statedir@
 
 # Make sure we use the IP addresses listed for
 # rpcbind.socket, no matter how this unit is started.
-Wants=rpcbind.socket
-After=rpcbind.socket
+Wants=rpcbind.socket rpcbind.target
+After=rpcbind.socket rpcbind.target

The last line should be:

After=rpcbind.socket
Before=rpcbind.target

Lennart

Signature · 1 line
Lennart Poettering, Red Hat