aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2024-04-24 12:01:40 +0200
committerKarel Zak <kzak@redhat.com>2024-04-24 12:01:40 +0200
commit18d10c16abaf1cf2934625624591f31318923050 (patch)
tree9081d8b8bab0b7178fbaec61192b3f273b456cd8
parent896a678f34ec49b5c10739e88256a74891fef223 (diff)
parenta20e7e23a8565e01b1c84de6924d1fbbdb1cfccc (diff)
downloadutil-linux-18d10c16abaf1cf2934625624591f31318923050.tar.gz
Merge branch 'PR/libmount-fix-umount-r' of github.com:karelzak/util-linux-work
* 'PR/libmount-fix-umount-r' of github.com:karelzak/util-linux-work: libmount: fix umount --read-only
-rw-r--r--libmount/src/context_umount.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c
index 79b62378d8..bf70ed2ee7 100644
--- a/libmount/src/context_umount.c
+++ b/libmount/src/context_umount.c
@@ -267,6 +267,9 @@ static int lookup_umount_fs_by_statfs(struct libmnt_context *cxt, const char *tg
* So, let's use statfs() if possible (it's bad idea for --lazy/--force
* umounts as target is probably unreachable NFS, also for --detach-loop
* as this additionally needs to know the name of the loop device).
+ *
+ * For the "umount --read-only" command, we need to read the mountinfo
+ * to obtain the mount source.
*/
if (mnt_context_is_restricted(cxt)
|| *tgt != '/'
@@ -275,6 +278,7 @@ static int lookup_umount_fs_by_statfs(struct libmnt_context *cxt, const char *tg
|| mnt_context_is_lazy(cxt)
|| mnt_context_is_nocanonicalize(cxt)
|| mnt_context_is_loopdel(cxt)
+ || mnt_context_is_rdonly_umount(cxt)
|| mnt_safe_stat(tgt, &st) != 0 || !S_ISDIR(st.st_mode)
|| has_utab_entry(cxt, tgt))
return 1; /* not found */