]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs_scrub_all: survive systemd restarts when waiting for services
authorDarrick J. Wong <djwong@kernel.org>
Fri, 12 Jan 2024 02:07:06 +0000 (18:07 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Fri, 12 Jan 2024 02:08:47 +0000 (18:08 -0800)
commit3abc6a0c3979bf19fa3e1d1126e363ea42c48971
tree47d2dbd177c952f276ee2d03a5ee14ce4f3f7753
parent27df677a7b31c51c4595d2ae9078927b790d94b9
xfs_scrub_all: survive systemd restarts when waiting for services

If xfs_scrub_all detects a running systemd, it will use it to invoke
xfs_scrub subprocesses in a sandboxed and resource-controlled
environment.  Unfortunately, if you happen to restart dbus or systemd
while it's running, you get this:

systemd[1]: Reexecuting.
xfs_scrub_all[9958]: Warning! D-Bus connection terminated.
xfs_scrub_all[9956]: Warning! D-Bus connection terminated.
xfs_scrub_all[9956]: Failed to wait for response: Connection reset by peer
xfs_scrub_all[9958]: Failed to wait for response: Connection reset by peer
xfs_scrub_all[9930]: Scrubbing / done, (err=1)
xfs_scrub_all[9930]: Scrubbing /storage done, (err=1)

The xfs_scrub units themselves are still running, it's just that the
`systemctl start' command that xfs_scrub_all uses to start and wait for
the unit lost its connection to dbus and hence is no longer monitoring
sub-services.

When this happens, we don't have great options -- systemctl doesn't have
a command to wait on an activating (aka running) unit.  Emulate the
functionality we normally get by polling the failed/active statuses.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
scrub/xfs_scrub_all.in