diff options
| author | Rafał Miłecki | 2018-12-10 06:48:50 +0000 |
|---|---|---|
| committer | Rafał Miłecki | 2018-12-12 13:02:38 +0000 |
| commit | 28753b3f027084fa2ca184bc8f8c54db36cc2421 (patch) | |
| tree | 12a835e9db629721cdedabad76526fc8d514d71e | |
| parent | c8c7ca567a4c14755ffc9014ee8e527af996a0ce (diff) | |
| download | fstools-28753b3f027084fa2ca184bc8f8c54db36cc2421.tar.gz | |
block: remove target directory after unmounting
This removes dangling directory fixing two issues:
1) Non autofs case
Leaving directory in /mnt/ and switching to autofs would result in
blockd failing to symlink().
2) autofs case
Leaving directory in /var/run/blockd/ could result in apps trying to
access it causing errors like:
blockd: kernel is requesting a mount -> sda1
blockd: failed to run block. add/sda1
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
| -rw-r--r-- | block.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1130,11 +1130,13 @@ static int umount_device(char *path) hotplug_call_mount("remove", basename(path)); err = umount2(mp, MNT_DETACH); - if (err) + if (err) { ULOG_ERR("unmounting %s (%s) failed (%d) - %m\n", path, mp, errno); - else + } else { ULOG_INFO("unmounted %s (%s)\n", path, mp); + rmdir(mp); + } free(mp); return err; |