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

cifs: add server param

As we get down to the transport layer, plenty of functions are passed
the session pointer and assume the transport to use is ses->server.

Instead we modify those functions to pass (ses, server) so that we
can decouple the session from the server.

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Steve French <stfrench@microsoft.com>

authored by

Aurelien Aptel and committed by
Steve French
f780bd3f bcc88801

+22 -17
+2 -1
fs/cifs/cifsglob.h
··· 230 230 bool (*compare_fids)(struct cifsFileInfo *, struct cifsFileInfo *); 231 231 /* setup request: allocate mid, sign message */ 232 232 struct mid_q_entry *(*setup_request)(struct cifs_ses *, 233 - struct smb_rqst *); 233 + struct TCP_Server_Info *, 234 + struct smb_rqst *); 234 235 /* setup async request: allocate mid, sign message */ 235 236 struct mid_q_entry *(*setup_async_request)(struct TCP_Server_Info *, 236 237 struct smb_rqst *);
+1
fs/cifs/cifsproto.h
··· 109 109 extern int SendReceiveNoRsp(const unsigned int xid, struct cifs_ses *ses, 110 110 char *in_buf, int flags); 111 111 extern struct mid_q_entry *cifs_setup_request(struct cifs_ses *, 112 + struct TCP_Server_Info *, 112 113 struct smb_rqst *); 113 114 extern struct mid_q_entry *cifs_setup_async_request(struct TCP_Server_Info *, 114 115 struct smb_rqst *);
+2 -1
fs/cifs/smb2proto.h
··· 46 46 extern int smb2_check_receive(struct mid_q_entry *mid, 47 47 struct TCP_Server_Info *server, bool log_error); 48 48 extern struct mid_q_entry *smb2_setup_request(struct cifs_ses *ses, 49 - struct smb_rqst *rqst); 49 + struct TCP_Server_Info *, 50 + struct smb_rqst *rqst); 50 51 extern struct mid_q_entry *smb2_setup_async_request( 51 52 struct TCP_Server_Info *server, struct smb_rqst *rqst); 52 53 extern struct cifs_ses *smb2_find_smb_ses(struct TCP_Server_Info *server,
+14 -13
fs/cifs/smb2transport.c
··· 610 610 } 611 611 612 612 static int 613 - smb2_get_mid_entry(struct cifs_ses *ses, struct smb2_sync_hdr *shdr, 614 - struct mid_q_entry **mid) 613 + smb2_get_mid_entry(struct cifs_ses *ses, struct TCP_Server_Info *server, 614 + struct smb2_sync_hdr *shdr, struct mid_q_entry **mid) 615 615 { 616 - if (ses->server->tcpStatus == CifsExiting) 616 + if (server->tcpStatus == CifsExiting) 617 617 return -ENOENT; 618 618 619 - if (ses->server->tcpStatus == CifsNeedReconnect) { 619 + if (server->tcpStatus == CifsNeedReconnect) { 620 620 cifs_dbg(FYI, "tcp session dead - return to caller to retry\n"); 621 621 return -EAGAIN; 622 622 } 623 623 624 - if (ses->server->tcpStatus == CifsNeedNegotiate && 624 + if (server->tcpStatus == CifsNeedNegotiate && 625 625 shdr->Command != SMB2_NEGOTIATE) 626 626 return -EAGAIN; 627 627 ··· 638 638 /* else ok - we are shutting down the session */ 639 639 } 640 640 641 - *mid = smb2_mid_entry_alloc(shdr, ses->server); 641 + *mid = smb2_mid_entry_alloc(shdr, server); 642 642 if (*mid == NULL) 643 643 return -ENOMEM; 644 644 spin_lock(&GlobalMid_Lock); 645 - list_add_tail(&(*mid)->qhead, &ses->server->pending_mid_q); 645 + list_add_tail(&(*mid)->qhead, &server->pending_mid_q); 646 646 spin_unlock(&GlobalMid_Lock); 647 647 648 648 return 0; ··· 675 675 } 676 676 677 677 struct mid_q_entry * 678 - smb2_setup_request(struct cifs_ses *ses, struct smb_rqst *rqst) 678 + smb2_setup_request(struct cifs_ses *ses, struct TCP_Server_Info *server, 679 + struct smb_rqst *rqst) 679 680 { 680 681 int rc; 681 682 struct smb2_sync_hdr *shdr = 682 683 (struct smb2_sync_hdr *)rqst->rq_iov[0].iov_base; 683 684 struct mid_q_entry *mid; 684 685 685 - smb2_seq_num_into_buf(ses->server, shdr); 686 + smb2_seq_num_into_buf(server, shdr); 686 687 687 - rc = smb2_get_mid_entry(ses, shdr, &mid); 688 + rc = smb2_get_mid_entry(ses, server, shdr, &mid); 688 689 if (rc) { 689 - revert_current_mid_from_hdr(ses->server, shdr); 690 + revert_current_mid_from_hdr(server, shdr); 690 691 return ERR_PTR(rc); 691 692 } 692 693 693 - rc = smb2_sign_rqst(rqst, ses->server); 694 + rc = smb2_sign_rqst(rqst, server); 694 695 if (rc) { 695 - revert_current_mid_from_hdr(ses->server, shdr); 696 + revert_current_mid_from_hdr(server, shdr); 696 697 cifs_delete_mid(mid); 697 698 return ERR_PTR(rc); 698 699 }
+3 -2
fs/cifs/transport.c
··· 936 936 } 937 937 938 938 struct mid_q_entry * 939 - cifs_setup_request(struct cifs_ses *ses, struct smb_rqst *rqst) 939 + cifs_setup_request(struct cifs_ses *ses, struct TCP_Server_Info *ignored, 940 + struct smb_rqst *rqst) 940 941 { 941 942 int rc; 942 943 struct smb_hdr *hdr = (struct smb_hdr *)rqst->rq_iov[0].iov_base; ··· 1054 1053 } 1055 1054 1056 1055 for (i = 0; i < num_rqst; i++) { 1057 - midQ[i] = server->ops->setup_request(ses, &rqst[i]); 1056 + midQ[i] = server->ops->setup_request(ses, server, &rqst[i]); 1058 1057 if (IS_ERR(midQ[i])) { 1059 1058 revert_current_mid(server, i); 1060 1059 for (j = 0; j < i; j++)