Skip to content

Commit c36ee7d

Browse files
Paulo AlcantaraSteve French
authored andcommitted
cifs: fix reconnect on smb3 mount types
cifs.ko defines two file system types: cifs & smb3, and __cifs_get_super() was not including smb3 file system type when looking up superblocks, therefore failing to reconnect tcons in cifs_tree_connect(). Fix this by calling iterate_supers_type() on both file system types. Link: https://lore.kernel.org/r/CAFrh3J9soC36+BVuwHB=g9z_KB5Og2+p2_W+BBoBOZveErz14w@mail.gmail.com Cc: [email protected] Tested-by: Satadru Pramanik <[email protected]> Reported-by: Satadru Pramanik <[email protected]> Signed-off-by: Paulo Alcantara (SUSE) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent f2906aa commit c36ee7d

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

fs/cifs/cifsfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,7 @@ struct file_system_type cifs_fs_type = {
10861086
};
10871087
MODULE_ALIAS_FS("cifs");
10881088

1089-
static struct file_system_type smb3_fs_type = {
1089+
struct file_system_type smb3_fs_type = {
10901090
.owner = THIS_MODULE,
10911091
.name = "smb3",
10921092
.init_fs_context = smb3_init_fs_context,

fs/cifs/cifsfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static inline unsigned long cifs_get_time(struct dentry *dentry)
3838
return (unsigned long) dentry->d_fsdata;
3939
}
4040

41-
extern struct file_system_type cifs_fs_type;
41+
extern struct file_system_type cifs_fs_type, smb3_fs_type;
4242
extern const struct address_space_operations cifs_addr_ops;
4343
extern const struct address_space_operations cifs_addr_ops_smallbuf;
4444

fs/cifs/misc.c

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,18 +1211,23 @@ static struct super_block *__cifs_get_super(void (*f)(struct super_block *, void
12111211
.data = data,
12121212
.sb = NULL,
12131213
};
1214+
struct file_system_type **fs_type = (struct file_system_type *[]) {
1215+
&cifs_fs_type, &smb3_fs_type, NULL,
1216+
};
12141217

1215-
iterate_supers_type(&cifs_fs_type, f, &sd);
1216-
1217-
if (!sd.sb)
1218-
return ERR_PTR(-EINVAL);
1219-
/*
1220-
* Grab an active reference in order to prevent automounts (DFS links)
1221-
* of expiring and then freeing up our cifs superblock pointer while
1222-
* we're doing failover.
1223-
*/
1224-
cifs_sb_active(sd.sb);
1225-
return sd.sb;
1218+
for (; *fs_type; fs_type++) {
1219+
iterate_supers_type(*fs_type, f, &sd);
1220+
if (sd.sb) {
1221+
/*
1222+
* Grab an active reference in order to prevent automounts (DFS links)
1223+
* of expiring and then freeing up our cifs superblock pointer while
1224+
* we're doing failover.
1225+
*/
1226+
cifs_sb_active(sd.sb);
1227+
return sd.sb;
1228+
}
1229+
}
1230+
return ERR_PTR(-EINVAL);
12261231
}
12271232

12281233
static void __cifs_put_super(struct super_block *sb)

0 commit comments

Comments
 (0)