|
|
7714f9 |
From 618aedc9e892b206492c1720bec261b043c66263 Mon Sep 17 00:00:00 2001
|
|
|
7714f9 |
From: Roberto Bergantinos Corpas <rbergant@redhat.com>
|
|
|
7714f9 |
Date: Mon, 27 Apr 2020 15:46:02 +0200
|
|
|
7714f9 |
Subject: [PATCH] libmount: fix mount -a EBUSY for cifs
|
|
|
7714f9 |
|
|
|
7714f9 |
fstab:
|
|
|
7714f9 |
|
|
|
7714f9 |
//rhel73/myshare/sub/path /mnt cifs
|
|
|
7714f9 |
|
|
|
7714f9 |
after mount in mountinfo:
|
|
|
7714f9 |
|
|
|
7714f9 |
# grep cifs /proc/self/mountinfo
|
|
|
7714f9 |
47 39 0:40 /sub/path /mnt rw,relatime shared:60 - cifs //rhel73/myshare/sub/path ...
|
|
|
7714f9 |
^^^^^^^^^
|
|
|
7714f9 |
or:
|
|
|
7714f9 |
|
|
|
7714f9 |
# grep cifs /proc/self/mountinfo
|
|
|
7714f9 |
47 39 0:40 / /mnt rw,relatime shared:60 - cifs //rhel73/myshare/sub/path ...
|
|
|
7714f9 |
^
|
|
|
7714f9 |
|
|
|
7714f9 |
That is so since on kernel cifs code, cifs_get_root (which returns the
|
|
|
7714f9 |
entry associated with mnt_root) return s_root if
|
|
|
7714f9 |
CIFS_MOUNT_USE_PREFIX_PATH is set, no questions asked.
|
|
|
7714f9 |
|
|
|
7714f9 |
This situation can occurr often on CIFS mounts, as CIFS servers limit
|
|
|
7714f9 |
frequently scope of access to the root path.
|
|
|
7714f9 |
|
|
|
7714f9 |
[kzak@redhat.com: - add more info to the commit message,
|
|
|
7714f9 |
- clean up variable names]
|
|
|
7714f9 |
|
|
|
7714f9 |
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1829245
|
|
|
7714f9 |
Upstream: http://github.com/karelzak/util-linux/commit/31b3a523eca2fc7e5876ec5fd89094208fed0899
|
|
|
7714f9 |
Signed-off-by: Roberto Bergantinos Corpas <rbergant@redhat.com>
|
|
|
7714f9 |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
7714f9 |
---
|
|
|
7714f9 |
libmount/src/tab.c | 11 ++++++-----
|
|
|
7714f9 |
1 file changed, 6 insertions(+), 5 deletions(-)
|
|
|
7714f9 |
|
|
|
7714f9 |
diff --git a/libmount/src/tab.c b/libmount/src/tab.c
|
|
|
7714f9 |
index 74d60df3d..cd97a1cb5 100644
|
|
|
7714f9 |
--- a/libmount/src/tab.c
|
|
|
7714f9 |
+++ b/libmount/src/tab.c
|
|
|
7714f9 |
@@ -1644,13 +1644,14 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_fs)
|
|
|
7714f9 |
if (root) {
|
|
|
7714f9 |
const char *fstype = mnt_fs_get_fstype(fs);
|
|
|
7714f9 |
|
|
|
7714f9 |
- if (fstype && (strcmp(fstype, "cifs") == 0
|
|
|
7714f9 |
- || strcmp(fstype, "smb3") == 0)) {
|
|
|
7714f9 |
+ if (fstype && (strcmp(fstype, "cifs") == 0 ||
|
|
|
7714f9 |
+ strcmp(fstype, "smb3") == 0)) {
|
|
|
7714f9 |
|
|
|
7714f9 |
- const char *unc_subdir = get_cifs_unc_subdir_path(src);
|
|
|
7714f9 |
- const char *path_on_fs = mnt_fs_get_root(fs);
|
|
|
7714f9 |
+ const char *sub = get_cifs_unc_subdir_path(src);
|
|
|
7714f9 |
+ const char *r = mnt_fs_get_root(fs);
|
|
|
7714f9 |
|
|
|
7714f9 |
- if (!unc_subdir || !path_on_fs || !streq_paths(unc_subdir, path_on_fs))
|
|
|
7714f9 |
+ if (!sub || !r || (!streq_paths(sub, r) &&
|
|
|
7714f9 |
+ !streq_paths("/", r)))
|
|
|
7714f9 |
continue;
|
|
|
7714f9 |
} else {
|
|
|
7714f9 |
const char *r = mnt_fs_get_root(fs);
|
|
|
7714f9 |
--
|
|
|
7714f9 |
2.25.4
|
|
|
7714f9 |
|