]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs_scrub_all: wait for services to start activating
authorDarrick J. Wong <djwong@kernel.org>
Tue, 29 Oct 2024 00:03:34 +0000 (17:03 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 31 Oct 2024 22:45:05 +0000 (15:45 -0700)
commit024f91c02f22a6f1f1256a5b09323bc3b104f839
tree133745a94d7762fb0489b23f82a7fb08b1e1126a
parent07c09d46665cfac48256f6faf829897554ec74bf
xfs_scrub_all: wait for services to start activating

It seems that the function call to start a systemd unit completes
asynchronously from any change in that unit's active state.  On a
lightly loaded system, a Start() call followed by an ActiveState()
call actually sees the change in state from inactive to activating.

Unfortunately, on a heavily loaded system, the state change may take a
few seconds.  If this is the case, the wait() call can see that the unit
state is "inactive", decide that the service already finished, and exit
early, when in reality it hasn't even gotten to 'activating'.

Fix this by adding a second method that watches either for the inactive
-> activating state transition or for the last exit from inactivation
timestamp to change before waiting for the unit to reach inactive state.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Cc: <linux-xfs@vger.kernel.org> # v6.10.0
Fixes: 6d831e770359ff ("xfs_scrub_all: convert systemctl calls to dbus")
Reviewed-by: Christoph Hellwig <hch@lst.de>
scrub/xfs_scrub_all.in