Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

cifs: add an smb3_fs_context to cifs_sb

and populate it during mount in cifs_smb3_do_mount()

Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>

authored by

Ronnie Sahlberg and committed by
Steve French
d17abdf7 4deb0759

+48 -41
+1
fs/cifs/cifs_fs_sb.h
··· 61 61 spinlock_t tlink_tree_lock; 62 62 struct tcon_link *master_tlink; 63 63 struct nls_table *local_nls; 64 + struct smb3_fs_context *ctx; 64 65 unsigned int bsize; 65 66 unsigned int rsize; 66 67 unsigned int wsize;
+36 -38
fs/cifs/cifsfs.c
··· 776 776 { 777 777 int rc; 778 778 struct super_block *sb; 779 - struct cifs_sb_info *cifs_sb; 780 - struct smb3_fs_context *ctx; 779 + struct cifs_sb_info *cifs_sb = NULL; 781 780 struct cifs_mnt_data mnt_data; 782 781 struct dentry *root; 783 782 ··· 789 790 else 790 791 cifs_info("Attempting to mount %s\n", old_ctx->UNC); 791 792 792 - ctx = kzalloc(sizeof(struct smb3_fs_context), GFP_KERNEL); 793 - if (!ctx) 794 - return ERR_PTR(-ENOMEM); 795 - rc = smb3_fs_context_dup(ctx, old_ctx); 796 - if (rc) { 797 - root = ERR_PTR(rc); 798 - goto out; 799 - } 800 - 801 - rc = cifs_setup_volume_info(ctx); 802 - if (rc) { 803 - root = ERR_PTR(rc); 804 - goto out; 805 - } 806 - 807 793 cifs_sb = kzalloc(sizeof(struct cifs_sb_info), GFP_KERNEL); 808 794 if (cifs_sb == NULL) { 809 795 root = ERR_PTR(-ENOMEM); 810 - goto out_nls; 796 + goto out; 811 797 } 812 798 813 - cifs_sb->mountdata = kstrndup(ctx->mount_options, PAGE_SIZE, GFP_KERNEL); 814 - if (cifs_sb->mountdata == NULL) { 799 + cifs_sb->ctx = kzalloc(sizeof(struct smb3_fs_context), GFP_KERNEL); 800 + if (!cifs_sb->ctx) { 815 801 root = ERR_PTR(-ENOMEM); 816 - goto out_free; 802 + goto out; 817 803 } 818 - 819 - rc = cifs_setup_cifs_sb(ctx, cifs_sb); 804 + rc = smb3_fs_context_dup(cifs_sb->ctx, old_ctx); 820 805 if (rc) { 821 806 root = ERR_PTR(rc); 822 - goto out_free; 807 + goto out; 823 808 } 824 809 825 - rc = cifs_mount(cifs_sb, ctx); 810 + rc = cifs_setup_volume_info(cifs_sb->ctx); 811 + if (rc) { 812 + root = ERR_PTR(rc); 813 + goto out; 814 + } 815 + 816 + cifs_sb->mountdata = kstrndup(cifs_sb->ctx->mount_options, PAGE_SIZE, GFP_KERNEL); 817 + if (cifs_sb->mountdata == NULL) { 818 + root = ERR_PTR(-ENOMEM); 819 + goto out; 820 + } 821 + 822 + rc = cifs_setup_cifs_sb(cifs_sb->ctx, cifs_sb); 823 + if (rc) { 824 + root = ERR_PTR(rc); 825 + goto out; 826 + } 827 + 828 + rc = cifs_mount(cifs_sb, cifs_sb->ctx); 826 829 if (rc) { 827 830 if (!(flags & SB_SILENT)) 828 831 cifs_dbg(VFS, "cifs_mount failed w/return code = %d\n", 829 832 rc); 830 833 root = ERR_PTR(rc); 831 - goto out_free; 834 + goto out; 832 835 } 833 836 834 - mnt_data.ctx = ctx; 837 + mnt_data.ctx = cifs_sb->ctx; 835 838 mnt_data.cifs_sb = cifs_sb; 836 839 mnt_data.flags = flags; 837 840 ··· 860 859 sb->s_flags |= SB_ACTIVE; 861 860 } 862 861 863 - root = cifs_get_root(ctx, sb); 862 + root = cifs_get_root(cifs_sb->ctx, sb); 864 863 if (IS_ERR(root)) 865 864 goto out_super; 866 865 867 866 cifs_dbg(FYI, "dentry root is: %p\n", root); 868 - goto out; 867 + return root; 869 868 870 869 out_super: 871 870 deactivate_locked_super(sb); 872 871 out: 873 - cifs_cleanup_volume_info(ctx); 872 + if (cifs_sb) { 873 + kfree(cifs_sb->prepath); 874 + kfree(cifs_sb->mountdata); 875 + cifs_cleanup_volume_info(cifs_sb->ctx); 876 + kfree(cifs_sb); 877 + } 874 878 return root; 875 - 876 - out_free: 877 - kfree(cifs_sb->prepath); 878 - kfree(cifs_sb->mountdata); 879 - kfree(cifs_sb); 880 - out_nls: 881 - unload_nls(ctx->local_nls); 882 - goto out; 883 879 } 884 880 885 881
+11 -3
fs/cifs/connect.c
··· 2799 2799 void 2800 2800 cifs_cleanup_volume_info_contents(struct smb3_fs_context *ctx) 2801 2801 { 2802 + if (ctx == NULL) 2803 + return; 2804 + 2802 2805 /* 2803 2806 * Make sure this stays in sync with smb3_fs_context_dup() 2804 2807 */ ··· 2821 2818 ctx->iocharset = NULL; 2822 2819 kfree(ctx->prepath); 2823 2820 ctx->prepath = NULL; 2821 + 2822 + unload_nls(ctx->local_nls); 2823 + ctx->local_nls = NULL; 2824 2824 } 2825 2825 2826 2826 void ··· 3745 3739 3746 3740 static void delayed_free(struct rcu_head *p) 3747 3741 { 3748 - struct cifs_sb_info *sbi = container_of(p, struct cifs_sb_info, rcu); 3749 - unload_nls(sbi->local_nls); 3750 - kfree(sbi); 3742 + struct cifs_sb_info *cifs_sb = container_of(p, struct cifs_sb_info, rcu); 3743 + 3744 + unload_nls(cifs_sb->local_nls); 3745 + cifs_cleanup_volume_info(cifs_sb->ctx); 3746 + kfree(cifs_sb); 3751 3747 } 3752 3748 3753 3749 void