diff options
author | Karel Zak | 2017-09-15 14:30:06 +0200 |
---|---|---|
committer | Karel Zak | 2017-09-15 14:30:06 +0200 |
commit | d369dc42cb4974d6a928ae28ed32fa11b528e5fb (patch) | |
tree | ffa3e5f491285c84cc5cad85d73b929917fabc30 /libmount/src/context_umount.c | |
parent | libsmartcols: fix heap-buffer-overflow when move columns (diff) | |
download | kernel-qcow2-util-linux-d369dc42cb4974d6a928ae28ed32fa11b528e5fb.tar.gz kernel-qcow2-util-linux-d369dc42cb4974d6a928ae28ed32fa11b528e5fb.tar.xz kernel-qcow2-util-linux-d369dc42cb4974d6a928ae28ed32fa11b528e5fb.zip |
libmount: export locking errors as MNT_EX_FILEIO
The mount man page assumes locking errors mapped to MNT_EX_FILEIO (16)
return code. Unfortunately, this is internally not exported as a
special error code, so it's returned as a generic (errno based)
stuff. This patch fixes this issue.
Note that we still use locking for example for utab or when enabled
/etc/mtab (disabled by default).
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/context_umount.c')
-rw-r--r-- | libmount/src/context_umount.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c index f2c304f4a..a8124629f 100644 --- a/libmount/src/context_umount.c +++ b/libmount/src/context_umount.c @@ -1063,6 +1063,10 @@ int mnt_context_get_umount_excode( if (buf) snprintf(buf, bufsz, _("not mounted")); return MNT_EX_USAGE; + } else if (rc == -MNT_ERR_LOCK) { + if (buf) + snprintf(buf, bufsz, _("locking failed")); + return MNT_EX_FILEIO; } return mnt_context_get_generic_excode(rc, buf, bufsz, _("umount failed: %m")); @@ -1072,7 +1076,12 @@ int mnt_context_get_umount_excode( * umount(2) syscall success, but something else failed * (probably error in mtab processing). */ - if (rc < 0) + if (rc == -MNT_ERR_LOCK) { + if (buf) + snprintf(buf, bufsz, _("filesystem was unmounted, but failed to update userspace mount table")); + return MNT_EX_FILEIO; + + } else if (rc < 0) return mnt_context_get_generic_excode(rc, buf, bufsz, _("filesystem was unmounted, but any subsequent operation failed: %m")); |