From 575443545936e6b8a1a4783e3d0e17d0246c6e99 Mon Sep 17 00:00:00 2001 From: Brett Smith Date: Wed, 21 Jan 2015 11:38:18 -0500 Subject: [PATCH] 4967: crunch-job unmounts old Keep mounts more robustly. The previous version looked for mounts under $JOB_WORK before unmounting anything. We long ago started mounting under $TASK_WORK, so unmounting hasn't been working for a while. This version unmounts every FUSE mount with "keep" in the path, so it will be much more flexible. I also changed the cleanup to use bash -e, so the logs are more likely to indicate if there was trouble during the cleanup step. --- sdk/cli/bin/crunch-job | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sdk/cli/bin/crunch-job b/sdk/cli/bin/crunch-job index caf6c0cd60..2415217a21 100755 --- a/sdk/cli/bin/crunch-job +++ b/sdk/cli/bin/crunch-job @@ -356,8 +356,12 @@ if (!defined $no_clear_tmp) { my $cleanpid = fork(); if ($cleanpid == 0) { + # Find FUSE mounts that look like Keep mounts (the mount path has the + # word "keep") and unmount them. Then clean up work directories. + # TODO: When #5036 is done and widely deployed, we can get rid of the + # regular expression and just unmount everything with type fuse.keep. srun (["srun", "--nodelist=$nodelist", "-D", $ENV{'TMPDIR'}], - ['bash', '-c', 'if mount | grep -q $JOB_WORK/; then for i in $JOB_WORK/*keep $CRUNCH_TMP/task/*.keep; do /bin/fusermount -z -u $i; done; fi; sleep 1; rm -rf $JOB_WORK $CRUNCH_INSTALL $CRUNCH_TMP/task $CRUNCH_TMP/src*']); + ['bash', '-ec', 'mount -t fuse,fuse.keep | awk \'($3 ~ /\ykeep\y/){print $3}\' | xargs -r -n 1 fusermount -u -z; sleep 1; rm -rf $JOB_WORK $CRUNCH_INSTALL $CRUNCH_TMP/task $CRUNCH_TMP/src*']); exit (1); } while (1) -- 2.30.2