cifs: fix reconnect on smb3 mount types
Subsystems (2)
PATCH 1/1 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 open here
Reported-by Satadru Pramanik <[email protected]>
Signed-off-by Paulo Alcantara (SUSE) <[email protected]>
--- fs/cifs/cifsfs.c | 2 +- fs/cifs/cifsfs.h | 2 +- fs/cifs/misc.c | 27 ++++++++++++++++----------- 3 files changed, 18 insertions(+), 13 deletions(-)
fs/cifs/cifsfs.c +1 -1
@@ -1086,7 +1086,7 @@ struct file_system_type cifs_fs_type = { };MODULE_ALIAS_FS ("cifs" ); -static struct file_system_type smb3_fs_type = { +struct file_system_type smb3_fs_type = { .owner =THIS_MODULE , .name ="smb3" , .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)return (unsigned long ) dentry->d_fsdata; } -extern struct file_system_type cifs_fs_type; +extern struct file_system_type cifs_fs_type, smb3_fs_type;extern const struct address_space_operations cifs_addr_ops;extern const struct address_space_operations cifs_addr_ops_smallbuf;
fs/cifs/misc.c +16 -11
@@ -1211,18 +1211,23 @@ static struct super_block *__cifs_get_super(void (*f)(struct super_block *, void .data = data, .sb = NULL, }; +struct file_system_type **fs_type = (struct file_system_type *[]) { + &cifs_fs_type, &smb3_fs_type,NULL , + }; -iterate_supers_type (&cifs_fs_type, f, &sd); - -if (!sd.sb) -return ERR_PTR (-EINVAL ); -/* -* Grab an active reference in order to prevent automounts (DFS links) -* of expiring and then freeing up our cifs superblock pointer while -* we're doing failover. -*/ -cifs_sb_active (sd.sb); -return sd.sb; +for (; *fs_type; fs_type++) { +iterate_supers_type (*fs_type, f, &sd); +if (sd.sb) { +/* +* Grab an active reference in order to prevent automounts (DFS links) +* of expiring and then freeing up our cifs superblock pointer while +* we're doing failover. +*/ +cifs_sb_active (sd.sb); +return sd.sb; + } + } +return ERR_PTR (-EINVAL ); }static void __cifs_put_super (struct super_block *sb)
Signature · 1 line
2.36.1
added cc:stable and tested-by and put updated patch in cifs-2.6.git for-next
Quoted 85 lines · Paulo Alcantara
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 incifs_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 open hereReported-by Satadru Pramanik <[email protected]>Signed-off-by Paulo Alcantara (SUSE) <[email protected]>--- fs/cifs/cifsfs.c | 2 +- fs/cifs/cifsfs.h | 2 +- fs/cifs/misc.c | 27 ++++++++++++++++----------- 3 files changed, 18 insertions(+), 13 deletions(-)fs/cifs/cifsfs.c +1
-1@@ -1086,7 +1086,7 @@ struct file_system_type cifs_fs_type = { };MODULE_ALIAS_FS ("cifs" ); -static struct file_system_type smb3_fs_type = { +struct file_system_type smb3_fs_type = { .owner =THIS_MODULE , .name ="smb3" , .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)return (unsigned long ) dentry->d_fsdata; } -extern struct file_system_type cifs_fs_type; +extern struct file_system_type cifs_fs_type, smb3_fs_type;extern const struct address_space_operations cifs_addr_ops;extern const struct address_space_operations cifs_addr_ops_smallbuf;fs/cifs/misc.c +16
-12@@ -1211,18 +1211,23 @@ static struct super_block *__cifs_get_super(void (*f)(struct super_block *, void .data = data, .sb = NULL, }; +struct file_system_type **fs_type = (struct file_system_type *[]) { + &cifs_fs_type, &smb3_fs_type,NULL , + }; -iterate_supers_type (&cifs_fs_type, f, &sd); - -if (!sd.sb) -return ERR_PTR (-EINVAL ); -/* -* Grab an active reference in order to prevent automounts (DFS links) -* of expiring and then freeing up our cifs superblock pointer while -* we're doing failover. -*/ -cifs_sb_active (sd.sb); -return sd.sb; +for (; *fs_type; fs_type++) { +iterate_supers_type (*fs_type, f, &sd); +if (sd.sb) { +/* +* Grab an active reference in order to prevent automounts (DFS links) +* of expiring and then freeing up our cifs superblock pointer while +* we're doing failover. +*/ +cifs_sb_active (sd.sb); +return sd.sb; + } + } +return ERR_PTR (-EINVAL ); }static void __cifs_put_super (struct super_block *sb) --2.36.1
Signature · 3 lines
Thanks, Steve