aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
authorPavel Shilovsky <piastry@etersoft.ru>2011-05-05 05:55:12 -0400
committerSteve French <sfrench@us.ibm.com>2011-05-23 23:07:42 -0400
commit724d9f1cfba0cb16a7151333b501e8f7885450d8 (patch)
treed86b0e84a9475374cdbd05cc1e4f85fd0231162f /fs/cifs/connect.c
parent37bb04e5a091a5330faef0cc09930326672b7061 (diff)
CIFS: Simplify mount code for further shared sb capability
Reorganize code to get mount option at first and when get a superblock. This lets us use shared superblock model further for equal mounts. Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c89
1 files changed, 50 insertions, 39 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 37b8ead2f60e..273cf42b2915 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2614,8 +2614,8 @@ convert_delimiter(char *path, char delim)
2614 } 2614 }
2615} 2615}
2616 2616
2617static void setup_cifs_sb(struct smb_vol *pvolume_info, 2617void cifs_setup_cifs_sb(struct smb_vol *pvolume_info,
2618 struct cifs_sb_info *cifs_sb) 2618 struct cifs_sb_info *cifs_sb)
2619{ 2619{
2620 INIT_DELAYED_WORK(&cifs_sb->prune_tlinks, cifs_prune_tlinks); 2620 INIT_DELAYED_WORK(&cifs_sb->prune_tlinks, cifs_prune_tlinks);
2621 2621
@@ -2671,6 +2671,7 @@ static void setup_cifs_sb(struct smb_vol *pvolume_info,
2671 cifs_sb->mnt_file_mode, cifs_sb->mnt_dir_mode); 2671 cifs_sb->mnt_file_mode, cifs_sb->mnt_dir_mode);
2672 2672
2673 cifs_sb->actimeo = pvolume_info->actimeo; 2673 cifs_sb->actimeo = pvolume_info->actimeo;
2674 cifs_sb->local_nls = pvolume_info->local_nls;
2674 2675
2675 if (pvolume_info->noperm) 2676 if (pvolume_info->noperm)
2676 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_PERM; 2677 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_PERM;
@@ -2747,8 +2748,8 @@ is_path_accessible(int xid, struct cifsTconInfo *tcon,
2747 return rc; 2748 return rc;
2748} 2749}
2749 2750
2750static void 2751void
2751cleanup_volume_info(struct smb_vol **pvolume_info) 2752cifs_cleanup_volume_info(struct smb_vol **pvolume_info)
2752{ 2753{
2753 struct smb_vol *volume_info; 2754 struct smb_vol *volume_info;
2754 2755
@@ -2854,40 +2855,13 @@ expand_dfs_referral(int xid, struct cifsSesInfo *pSesInfo,
2854} 2855}
2855#endif 2856#endif
2856 2857
2857int 2858int cifs_setup_volume_info(struct smb_vol **pvolume_info, char *mount_data,
2858cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, 2859 const char *devname)
2859 const char *devname)
2860{ 2860{
2861 int rc;
2862 int xid;
2863 struct smb_vol *volume_info; 2861 struct smb_vol *volume_info;
2864 struct cifsSesInfo *pSesInfo; 2862 int rc = 0;
2865 struct cifsTconInfo *tcon;
2866 struct TCP_Server_Info *srvTcp;
2867 char *full_path;
2868 struct tcon_link *tlink;
2869#ifdef CONFIG_CIFS_DFS_UPCALL
2870 int referral_walks_count = 0;
2871try_mount_again:
2872 /* cleanup activities if we're chasing a referral */
2873 if (referral_walks_count) {
2874 if (tcon)
2875 cifs_put_tcon(tcon);
2876 else if (pSesInfo)
2877 cifs_put_smb_ses(pSesInfo);
2878
2879 cleanup_volume_info(&volume_info);
2880 FreeXid(xid);
2881 }
2882#endif
2883 rc = 0;
2884 tcon = NULL;
2885 pSesInfo = NULL;
2886 srvTcp = NULL;
2887 full_path = NULL;
2888 tlink = NULL;
2889 2863
2890 xid = GetXid(); 2864 *pvolume_info = NULL;
2891 2865
2892 volume_info = kzalloc(sizeof(struct smb_vol), GFP_KERNEL); 2866 volume_info = kzalloc(sizeof(struct smb_vol), GFP_KERNEL);
2893 if (!volume_info) { 2867 if (!volume_info) {
@@ -2895,7 +2869,7 @@ try_mount_again:
2895 goto out; 2869 goto out;
2896 } 2870 }
2897 2871
2898 if (cifs_parse_mount_options(cifs_sb->mountdata, devname, 2872 if (cifs_parse_mount_options(mount_data, devname,
2899 volume_info)) { 2873 volume_info)) {
2900 rc = -EINVAL; 2874 rc = -EINVAL;
2901 goto out; 2875 goto out;
@@ -2928,7 +2902,46 @@ try_mount_again:
2928 goto out; 2902 goto out;
2929 } 2903 }
2930 } 2904 }
2931 cifs_sb->local_nls = volume_info->local_nls; 2905
2906 *pvolume_info = volume_info;
2907 return rc;
2908out:
2909 cifs_cleanup_volume_info(&volume_info);
2910 return rc;
2911}
2912
2913int
2914cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2915 struct smb_vol *volume_info, const char *devname)
2916{
2917 int rc = 0;
2918 int xid;
2919 struct cifsSesInfo *pSesInfo;
2920 struct cifsTconInfo *tcon;
2921 struct TCP_Server_Info *srvTcp;
2922 char *full_path;
2923 struct tcon_link *tlink;
2924#ifdef CONFIG_CIFS_DFS_UPCALL
2925 int referral_walks_count = 0;
2926try_mount_again:
2927 /* cleanup activities if we're chasing a referral */
2928 if (referral_walks_count) {
2929 if (tcon)
2930 cifs_put_tcon(tcon);
2931 else if (pSesInfo)
2932 cifs_put_smb_ses(pSesInfo);
2933
2934 cifs_cleanup_volume_info(&volume_info);
2935 FreeXid(xid);
2936 }
2937#endif
2938 tcon = NULL;
2939 pSesInfo = NULL;
2940 srvTcp = NULL;
2941 full_path = NULL;
2942 tlink = NULL;
2943
2944 xid = GetXid();
2932 2945
2933 /* get a reference to a tcp session */ 2946 /* get a reference to a tcp session */
2934 srvTcp = cifs_get_tcp_session(volume_info); 2947 srvTcp = cifs_get_tcp_session(volume_info);
@@ -2945,7 +2958,6 @@ try_mount_again:
2945 goto mount_fail_check; 2958 goto mount_fail_check;
2946 } 2959 }
2947 2960
2948 setup_cifs_sb(volume_info, cifs_sb);
2949 if (pSesInfo->capabilities & CAP_LARGE_FILES) 2961 if (pSesInfo->capabilities & CAP_LARGE_FILES)
2950 sb->s_maxbytes = MAX_LFS_FILESIZE; 2962 sb->s_maxbytes = MAX_LFS_FILESIZE;
2951 else 2963 else
@@ -3101,7 +3113,6 @@ mount_fail_check:
3101 password will be freed at unmount time) */ 3113 password will be freed at unmount time) */
3102out: 3114out:
3103 /* zero out password before freeing */ 3115 /* zero out password before freeing */
3104 cleanup_volume_info(&volume_info);
3105 FreeXid(xid); 3116 FreeXid(xid);
3106 return rc; 3117 return rc;
3107} 3118}