From: Darrick J. Wong <djwong@xxxxxxxxxx> In commit 07c6fd59, I fixed this script so that it would escape pathnames correctly when passing them as unit instance variables to systemctl start. Unfortunately, I neglected to do this for systemctl stop, which leads to warnings if someone hit ^C while the program is running from a CLI. Fix that, and name the unit name variable consistently. Fixes: 07c6fd59 ("xfs_scrub_all: escape paths being passed to systemd service instances") Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> --- scrub/xfs_scrub_all.in | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scrub/xfs_scrub_all.in b/scrub/xfs_scrub_all.in index 32bcfb15f5a..2bdbccffd9c 100644 --- a/scrub/xfs_scrub_all.in +++ b/scrub/xfs_scrub_all.in @@ -58,10 +58,10 @@ def find_mounts(): return fs -def kill_systemd(unit, proc): +def kill_systemd(unitname, proc): '''Kill systemd unit.''' proc.terminate() - cmd=['systemctl', 'stop', unit] + cmd = ['systemctl', 'stop', unitname] x = subprocess.Popen(cmd) x.wait() @@ -119,9 +119,10 @@ def run_scrub(mnt, cond, running_devs, mntdevs, killfuncs): return # Try it the systemd way - cmd=['systemctl', 'start', 'xfs_scrub@%s' % systemd_escape(mnt)] + unitname = 'xfs_scrub@%s' % systemd_escape(mnt) + cmd = ['systemctl', 'start', unitname] ret = run_killable(cmd, DEVNULL(), killfuncs, \ - lambda proc: kill_systemd('xfs_scrub@%s' % mnt, proc)) + lambda proc: kill_systemd(unitname, proc)) if ret == 0 or ret == 1: print("Scrubbing %s done, (err=%d)" % (mnt, ret)) sys.stdout.flush()