Skip to content

Commit

Permalink
tmpdir-setup: Make umount faster
Browse files Browse the repository at this point in the history
The umount of the job tmpdir often takes a lot of time (minutes!) when
the user write a lot of data to it, because there are many dirty pages
which are written to the disk before the umount completes.

This writing is obviously a waste of resources, because as soon as the
unmount is finished, the backup image for the filesystem is destroyed
anyway.

Unfortunatly, we currenty don't have a solid way to avoid the
unnecessary writeback.

What we can do is to purge the directory. Experiments show, that this is
indeed faster with both: few very big files or many small files. So do
that.

Hard-code the directory prefix into the rm command to decrease the risk
of rm removing wrong files in case future code changes are buggy and,
for example, missspell a shell variable.

Because the cleanup still needs time, do that in the background so that
mxqd can continue.
  • Loading branch information
donald committed May 10, 2022
1 parent 16b0457 commit 9640f65
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions helper/tmpdir-setup
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ cmd_cleanup() {
(( $# == 1 )) || usage
MXQ_JOBID=$1

mountpoint=$mntdir/$MXQ_JOBID

umount $mountpoint
rmdir $mountpoint
(
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
) &
}

(( $# > 0 )) || usage
Expand Down

0 comments on commit 9640f65

Please sign in to comment.