]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: improve smb{2,3} support
authorKarel Zak <kzak@redhat.com>
Wed, 11 Mar 2020 09:38:37 +0000 (10:38 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 11 Mar 2020 09:47:52 +0000 (10:47 +0100)
It seems kernel can use smb3 as fstype in mountinfo.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1812118
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/tab.c
libmount/src/utils.c

index 2218285b4cbe41316928fd155ba3afae307a34ce..aeeefcde68ff169e5daa46c911803d8e771c0860 100644 (file)
@@ -1763,9 +1763,13 @@ int __mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_f
                if (root) {
                        const char *fstype = mnt_fs_get_fstype(fs);
 
-                       if (fstype && strcmp(fstype, "cifs") == 0) {
+                       if (fstype && (strcmp(fstype, "cifs") == 0
+                                      || strcmp(fstype, "smb2") == 0
+                                      || strcmp(fstype, "smb3") == 0)) {
+
                                const char *unc_subdir = get_cifs_unc_subdir_path(src);
                                const char *path_on_fs = mnt_fs_get_root(fs);
+
                                if (!unc_subdir || !path_on_fs || !streq_paths(unc_subdir, path_on_fs))
                                        continue;
                        } else {
index 708da2e008b594161147046c97dfb9c58383a50b..90c84f400940eca2a582aa1ef65e4ff9ac414399 100644 (file)
@@ -332,6 +332,8 @@ int mnt_fstype_is_pseudofs(const char *type)
 int mnt_fstype_is_netfs(const char *type)
 {
        if (strcmp(type, "cifs")   == 0 ||
+           strcmp(type, "smb2")   == 0 ||
+           strcmp(type, "smb3")   == 0 ||
            strcmp(type, "smbfs")  == 0 ||
            strncmp(type,"nfs", 3) == 0 ||
            strcmp(type, "afs")    == 0 ||