From 1d11d14506a56f6305421658a3351ff291338d23 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Fri, 28 Oct 2022 10:55:02 +0200 Subject: [PATCH] tmpdir-setup: Don't umount in background The old cleanup code runs in the background, which is okay for normal operations. However when mxqd restarts and finds jobs, which have finished in the meantime, it calls the tmpdir cleanup code for theses jobs. Later during recovery, it scans the spool area for other remaining tmpdir mounts and calls the cleanup code for these. This races with the oridnary cleanup when it is asynchronous. This bug exists in 0.30.7 and has nothing to do with the current changes. It is only triggered when a restarting mxqd finds completed jobs. There is no harm done, the jobs complete normally, the tmpdir is cleand up. The second attempted cleanup just produces some error messages in the log. Without any other side effects. As the "old style" tmpdir setup is going away anyway, don't invent something complicated here and just do the cleanup synchronously. --- helper/tmpdir-setup | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/helper/tmpdir-setup b/helper/tmpdir-setup index 5b5e1808..384d9bec 100755 --- a/helper/tmpdir-setup +++ b/helper/tmpdir-setup @@ -61,12 +61,10 @@ cmd_cleanup() { # Support rolling upgrade: Use old code if loop device is directly mounted without a dm device in between. # if [[ $(findmnt --output SOURCE --noheadings /dev/shm/mxqd/mnt/job/$MXQ_JOBID) =~ ^/dev/loop ]]; then - ( - shopt -s dotglob - rm -rf /dev/shm/mxqd/mnt/job/$MXQ_JOBID/* - umount /dev/shm/mxqd/mnt/job/$MXQ_JOBID - rmdir /dev/shm/mxqd/mnt/job/$MXQ_JOBID - ) & + shopt -s dotglob + rm -rf /dev/shm/mxqd/mnt/job/$MXQ_JOBID/* + umount /dev/shm/mxqd/mnt/job/$MXQ_JOBID + rmdir /dev/shm/mxqd/mnt/job/$MXQ_JOBID exit fi