History

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.

Paulo Alcantara committed 4 years ago

Commit c36ee7d1 parent f2906aa3 files · +18 −13Browse files

Unified · Split

3 files
  1. fs/cifs/cifsfs.c +1 −1
  2. fs/cifs/cifsfs.h +1 −1
  3. fs/cifs/misc.c +16 −11
fs/cifs/cifsfs.c+1−1
@@ -1086,7 +1086,7 @@ struct file_system_type cifs_fs_type = { · 1085 unmodified lines
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+1−1
@@ -38,7 +38,7 @@ static inline unsigned long cifs_get_time(struct dentry *dentry) · 37 unmodified lines
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+16−11
@@ -1211,18 +1211,23 @@ static struct super_block *__cifs_get_super(void (*f)(struct super_block *, void · 1210 unmodified lines
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)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t