diff options
-rw-r--r-- | fs/cifs/cifsglob.h | 6 | ||||
-rw-r--r-- | fs/cifs/cifsproto.h | 8 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 2 | ||||
-rw-r--r-- | fs/cifs/connect.c | 73 | ||||
-rw-r--r-- | fs/cifs/smb1ops.c | 2 |
5 files changed, 56 insertions, 35 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index a6eb9befdb2d..6d18962c9903 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -160,6 +160,7 @@ struct mid_q_entry; | |||
160 | struct TCP_Server_Info; | 160 | struct TCP_Server_Info; |
161 | struct cifsFileInfo; | 161 | struct cifsFileInfo; |
162 | struct cifs_ses; | 162 | struct cifs_ses; |
163 | struct cifs_tcon; | ||
163 | 164 | ||
164 | struct smb_version_operations { | 165 | struct smb_version_operations { |
165 | int (*send_cancel)(struct TCP_Server_Info *, void *, | 166 | int (*send_cancel)(struct TCP_Server_Info *, void *, |
@@ -201,6 +202,11 @@ struct smb_version_operations { | |||
201 | const struct nls_table *); | 202 | const struct nls_table *); |
202 | /* close smb session */ | 203 | /* close smb session */ |
203 | int (*logoff)(const unsigned int, struct cifs_ses *); | 204 | int (*logoff)(const unsigned int, struct cifs_ses *); |
205 | /* connect to a server share */ | ||
206 | int (*tree_connect)(const unsigned int, struct cifs_ses *, const char *, | ||
207 | struct cifs_tcon *, const struct nls_table *); | ||
208 | /* close tree connecion */ | ||
209 | int (*tree_disconnect)(const unsigned int, struct cifs_tcon *); | ||
204 | }; | 210 | }; |
205 | 211 | ||
206 | struct smb_version_values { | 212 | struct smb_version_values { |
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index a17be2618473..5fbd6b9a64d9 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -184,9 +184,9 @@ extern int cifs_setup_session(const unsigned int xid, struct cifs_ses *ses, | |||
184 | struct nls_table *nls_info); | 184 | struct nls_table *nls_info); |
185 | extern int CIFSSMBNegotiate(const unsigned int xid, struct cifs_ses *ses); | 185 | extern int CIFSSMBNegotiate(const unsigned int xid, struct cifs_ses *ses); |
186 | 186 | ||
187 | extern int CIFSTCon(unsigned int xid, struct cifs_ses *ses, | 187 | extern int CIFSTCon(const unsigned int xid, struct cifs_ses *ses, |
188 | const char *tree, struct cifs_tcon *tcon, | 188 | const char *tree, struct cifs_tcon *tcon, |
189 | const struct nls_table *); | 189 | const struct nls_table *); |
190 | 190 | ||
191 | extern int CIFSFindFirst(const int xid, struct cifs_tcon *tcon, | 191 | extern int CIFSFindFirst(const int xid, struct cifs_tcon *tcon, |
192 | const char *searchName, const struct nls_table *nls_codepage, | 192 | const char *searchName, const struct nls_table *nls_codepage, |
@@ -389,7 +389,7 @@ extern int CIFSSMBPosixLock(const int xid, struct cifs_tcon *tcon, | |||
389 | const loff_t start_offset, const __u64 len, | 389 | const loff_t start_offset, const __u64 len, |
390 | struct file_lock *, const __u16 lock_type, | 390 | struct file_lock *, const __u16 lock_type, |
391 | const bool waitFlag); | 391 | const bool waitFlag); |
392 | extern int CIFSSMBTDis(const int xid, struct cifs_tcon *tcon); | 392 | extern int CIFSSMBTDis(const unsigned int xid, struct cifs_tcon *tcon); |
393 | extern int CIFSSMBEcho(struct TCP_Server_Info *server); | 393 | extern int CIFSSMBEcho(struct TCP_Server_Info *server); |
394 | extern int CIFSSMBLogoff(const unsigned int xid, struct cifs_ses *ses); | 394 | extern int CIFSSMBLogoff(const unsigned int xid, struct cifs_ses *ses); |
395 | 395 | ||
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 915b8fc212e9..98fc454827af 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -694,7 +694,7 @@ neg_err_exit: | |||
694 | } | 694 | } |
695 | 695 | ||
696 | int | 696 | int |
697 | CIFSSMBTDis(const int xid, struct cifs_tcon *tcon) | 697 | CIFSSMBTDis(const unsigned int xid, struct cifs_tcon *tcon) |
698 | { | 698 | { |
699 | struct smb_hdr *smb_buffer; | 699 | struct smb_hdr *smb_buffer; |
700 | int rc = 0; | 700 | int rc = 0; |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 444243d9232b..fcf20d1b58b9 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -2542,7 +2542,7 @@ cifs_find_tcon(struct cifs_ses *ses, const char *unc) | |||
2542 | static void | 2542 | static void |
2543 | cifs_put_tcon(struct cifs_tcon *tcon) | 2543 | cifs_put_tcon(struct cifs_tcon *tcon) |
2544 | { | 2544 | { |
2545 | int xid; | 2545 | unsigned int xid; |
2546 | struct cifs_ses *ses = tcon->ses; | 2546 | struct cifs_ses *ses = tcon->ses; |
2547 | 2547 | ||
2548 | cFYI(1, "%s: tc_count=%d", __func__, tcon->tc_count); | 2548 | cFYI(1, "%s: tc_count=%d", __func__, tcon->tc_count); |
@@ -2556,7 +2556,8 @@ cifs_put_tcon(struct cifs_tcon *tcon) | |||
2556 | spin_unlock(&cifs_tcp_ses_lock); | 2556 | spin_unlock(&cifs_tcp_ses_lock); |
2557 | 2557 | ||
2558 | xid = GetXid(); | 2558 | xid = GetXid(); |
2559 | CIFSSMBTDis(xid, tcon); | 2559 | if (ses->server->ops->tree_disconnect) |
2560 | ses->server->ops->tree_disconnect(xid, tcon); | ||
2560 | _FreeXid(xid); | 2561 | _FreeXid(xid); |
2561 | 2562 | ||
2562 | cifs_fscache_release_super_cookie(tcon); | 2563 | cifs_fscache_release_super_cookie(tcon); |
@@ -2581,6 +2582,11 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb_vol *volume_info) | |||
2581 | return tcon; | 2582 | return tcon; |
2582 | } | 2583 | } |
2583 | 2584 | ||
2585 | if (!ses->server->ops->tree_connect) { | ||
2586 | rc = -ENOSYS; | ||
2587 | goto out_fail; | ||
2588 | } | ||
2589 | |||
2584 | tcon = tconInfoAlloc(); | 2590 | tcon = tconInfoAlloc(); |
2585 | if (tcon == NULL) { | 2591 | if (tcon == NULL) { |
2586 | rc = -ENOMEM; | 2592 | rc = -ENOMEM; |
@@ -2603,13 +2609,15 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb_vol *volume_info) | |||
2603 | goto out_fail; | 2609 | goto out_fail; |
2604 | } | 2610 | } |
2605 | 2611 | ||
2606 | /* BB Do we need to wrap session_mutex around | 2612 | /* |
2607 | * this TCon call and Unix SetFS as | 2613 | * BB Do we need to wrap session_mutex around this TCon call and Unix |
2608 | * we do on SessSetup and reconnect? */ | 2614 | * SetFS as we do on SessSetup and reconnect? |
2615 | */ | ||
2609 | xid = GetXid(); | 2616 | xid = GetXid(); |
2610 | rc = CIFSTCon(xid, ses, volume_info->UNC, tcon, volume_info->local_nls); | 2617 | rc = ses->server->ops->tree_connect(xid, ses, volume_info->UNC, tcon, |
2618 | volume_info->local_nls); | ||
2611 | FreeXid(xid); | 2619 | FreeXid(xid); |
2612 | cFYI(1, "CIFS Tcon rc = %d", rc); | 2620 | cFYI(1, "Tcon rc = %d", rc); |
2613 | if (rc) | 2621 | if (rc) |
2614 | goto out_fail; | 2622 | goto out_fail; |
2615 | 2623 | ||
@@ -2618,10 +2626,11 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb_vol *volume_info) | |||
2618 | cFYI(1, "DFS disabled (%d)", tcon->Flags); | 2626 | cFYI(1, "DFS disabled (%d)", tcon->Flags); |
2619 | } | 2627 | } |
2620 | tcon->seal = volume_info->seal; | 2628 | tcon->seal = volume_info->seal; |
2621 | /* we can have only one retry value for a connection | 2629 | /* |
2622 | to a share so for resources mounted more than once | 2630 | * We can have only one retry value for a connection to a share so for |
2623 | to the same server share the last value passed in | 2631 | * resources mounted more than once to the same server share the last |
2624 | for the retry flag is used */ | 2632 | * value passed in for the retry flag is used. |
2633 | */ | ||
2625 | tcon->retry = volume_info->retry; | 2634 | tcon->retry = volume_info->retry; |
2626 | tcon->nocase = volume_info->nocase; | 2635 | tcon->nocase = volume_info->nocase; |
2627 | tcon->local_lease = volume_info->local_lease; | 2636 | tcon->local_lease = volume_info->local_lease; |
@@ -2755,37 +2764,41 @@ out: | |||
2755 | } | 2764 | } |
2756 | 2765 | ||
2757 | int | 2766 | int |
2758 | get_dfs_path(int xid, struct cifs_ses *pSesInfo, const char *old_path, | 2767 | get_dfs_path(int xid, struct cifs_ses *ses, const char *old_path, |
2759 | const struct nls_table *nls_codepage, unsigned int *pnum_referrals, | 2768 | const struct nls_table *nls_codepage, unsigned int *num_referrals, |
2760 | struct dfs_info3_param **preferrals, int remap) | 2769 | struct dfs_info3_param **referrals, int remap) |
2761 | { | 2770 | { |
2762 | char *temp_unc; | 2771 | char *temp_unc; |
2763 | int rc = 0; | 2772 | int rc = 0; |
2764 | 2773 | ||
2765 | *pnum_referrals = 0; | 2774 | if (!ses->server->ops->tree_connect) |
2766 | *preferrals = NULL; | 2775 | return -ENOSYS; |
2776 | |||
2777 | *num_referrals = 0; | ||
2778 | *referrals = NULL; | ||
2767 | 2779 | ||
2768 | if (pSesInfo->ipc_tid == 0) { | 2780 | if (ses->ipc_tid == 0) { |
2769 | temp_unc = kmalloc(2 /* for slashes */ + | 2781 | temp_unc = kmalloc(2 /* for slashes */ + |
2770 | strnlen(pSesInfo->serverName, | 2782 | strnlen(ses->serverName, SERVER_NAME_LEN_WITH_NULL * 2) |
2771 | SERVER_NAME_LEN_WITH_NULL * 2) | 2783 | + 1 + 4 /* slash IPC$ */ + 2, GFP_KERNEL); |
2772 | + 1 + 4 /* slash IPC$ */ + 2, | ||
2773 | GFP_KERNEL); | ||
2774 | if (temp_unc == NULL) | 2784 | if (temp_unc == NULL) |
2775 | return -ENOMEM; | 2785 | return -ENOMEM; |
2776 | temp_unc[0] = '\\'; | 2786 | temp_unc[0] = '\\'; |
2777 | temp_unc[1] = '\\'; | 2787 | temp_unc[1] = '\\'; |
2778 | strcpy(temp_unc + 2, pSesInfo->serverName); | 2788 | strcpy(temp_unc + 2, ses->serverName); |
2779 | strcpy(temp_unc + 2 + strlen(pSesInfo->serverName), "\\IPC$"); | 2789 | strcpy(temp_unc + 2 + strlen(ses->serverName), "\\IPC$"); |
2780 | rc = CIFSTCon(xid, pSesInfo, temp_unc, NULL, nls_codepage); | 2790 | rc = ses->server->ops->tree_connect(xid, ses, temp_unc, NULL, |
2781 | cFYI(1, "CIFS Tcon rc = %d ipc_tid = %d", rc, pSesInfo->ipc_tid); | 2791 | nls_codepage); |
2792 | cFYI(1, "Tcon rc = %d ipc_tid = %d", rc, ses->ipc_tid); | ||
2782 | kfree(temp_unc); | 2793 | kfree(temp_unc); |
2783 | } | 2794 | } |
2784 | if (rc == 0) | 2795 | if (rc == 0) |
2785 | rc = CIFSGetDFSRefer(xid, pSesInfo, old_path, preferrals, | 2796 | rc = CIFSGetDFSRefer(xid, ses, old_path, referrals, |
2786 | pnum_referrals, nls_codepage, remap); | 2797 | num_referrals, nls_codepage, remap); |
2787 | /* BB map targetUNCs to dfs_info3 structures, here or | 2798 | /* |
2788 | in CIFSGetDFSRefer BB */ | 2799 | * BB - map targetUNCs to dfs_info3 structures, here or in |
2800 | * CIFSGetDFSRefer. | ||
2801 | */ | ||
2789 | 2802 | ||
2790 | return rc; | 2803 | return rc; |
2791 | } | 2804 | } |
@@ -3777,7 +3790,7 @@ out: | |||
3777 | * pointer may be NULL. | 3790 | * pointer may be NULL. |
3778 | */ | 3791 | */ |
3779 | int | 3792 | int |
3780 | CIFSTCon(unsigned int xid, struct cifs_ses *ses, | 3793 | CIFSTCon(const unsigned int xid, struct cifs_ses *ses, |
3781 | const char *tree, struct cifs_tcon *tcon, | 3794 | const char *tree, struct cifs_tcon *tcon, |
3782 | const struct nls_table *nls_codepage) | 3795 | const struct nls_table *nls_codepage) |
3783 | { | 3796 | { |
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index 6b0a5d616338..728595f096c9 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c | |||
@@ -432,6 +432,8 @@ struct smb_version_operations smb1_operations = { | |||
432 | .negotiate = cifs_negotiate, | 432 | .negotiate = cifs_negotiate, |
433 | .sess_setup = CIFS_SessSetup, | 433 | .sess_setup = CIFS_SessSetup, |
434 | .logoff = CIFSSMBLogoff, | 434 | .logoff = CIFSSMBLogoff, |
435 | .tree_connect = CIFSTCon, | ||
436 | .tree_disconnect = CIFSSMBTDis, | ||
435 | }; | 437 | }; |
436 | 438 | ||
437 | struct smb_version_values smb1_values = { | 439 | struct smb_version_values smb1_values = { |