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
1086};1086};
1087MODULE_ALIAS_FS("cifs");1087MODULE_ALIAS_FS("cifs");
1088 1088
1089static struct file_system_type smb3_fs_type = {1089struct file_system_type smb3_fs_type = {
1090 .owner = THIS_MODULE,1090 .owner = THIS_MODULE,
1091 .name = "smb3",1091 .name = "smb3",
1092 .init_fs_context = smb3_init_fs_context,1092 .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
38 return (unsigned long) dentry->d_fsdata;38 return (unsigned long) dentry->d_fsdata;
39}39}
40 40
41extern struct file_system_type cifs_fs_type;41extern struct file_system_type cifs_fs_type, smb3_fs_type;
42extern const struct address_space_operations cifs_addr_ops;42extern const struct address_space_operations cifs_addr_ops;
43extern const struct address_space_operations cifs_addr_ops_smallbuf;43extern const struct address_space_operations cifs_addr_ops_smallbuf;
44 44
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
1211 .data = data,1211 .data = data,
1212 .sb = NULL,1212 .sb = NULL,
1213 };1213 };
1214 struct file_system_type **fs_type = (struct file_system_type *[]) {
1215 &cifs_fs_type, &smb3_fs_type, NULL,
1216 };
1214 1217
1215 iterate_supers_type(&cifs_fs_type, f, &sd);1218 for (; *fs_type; fs_type++) {
1216 1219 iterate_supers_type(*fs_type, f, &sd);
1217 if (!sd.sb)1220 if (sd.sb) {
1218 return ERR_PTR(-EINVAL);1221 /*
1219 /*1222 * Grab an active reference in order to prevent automounts (DFS links)
1220 * Grab an active reference in order to prevent automounts (DFS links)1223 * of expiring and then freeing up our cifs superblock pointer while
1221 * of expiring and then freeing up our cifs superblock pointer while1224 * we're doing failover.
1222 * we're doing failover.1225 */
1223 */1226 cifs_sb_active(sd.sb);
1224 cifs_sb_active(sd.sb);1227 return sd.sb;
1225 return sd.sb;1228 }
1229 }
1230 return ERR_PTR(-EINVAL);
1226}1231}
1227 1232
1228static void __cifs_put_super(struct super_block *sb)1233static 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