]> www.infradead.org Git - users/hch/xfsprogs.git/commit
xfs_scrub_all: wait for services to start activating
authorDarrick J. Wong <djwong@kernel.org>
Tue, 22 Oct 2024 00:44:13 +0000 (17:44 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Fri, 1 Nov 2024 20:44:43 +0000 (13:44 -0700)
commit68decee0c3a55aaab528c8fbdb4d228b383f889b
treedc9f60b273d51fa4ab588db9da705fc8b74e7b79
parented2b3e2c57d9b8a6f009a418e31fbbf146aef494
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