cifs: implement hard mount option behaviour
PATCH 1/1 cifs: implement hard mount option behaviour
Quoted 1 line
From
13bc9a6e9808c6a12c26ef25ead8a70210e75bccMon Sep 17 00:00:00 2001
From: Shirish Pargaonkar <[email protected]>
Date: Tue, 25 May 2010 21:07:24 -0500
Subject: [PATCH] add support for implementing hard mount option behaviour
--- fs/cifs/cifsproto.h | 5 ++- fs/cifs/cifssmb.c | 99 ++++++++++++++++++++++++++------------------------ fs/cifs/connect.c | 5 ++- fs/cifs/sess.c | 2 +- fs/cifs/transport.c | 60 ++++++++++++++++++++++++++++--- 5 files changed, 113 insertions(+), 58 deletions(-)
fs/cifs/cifsproto.h +3 -2
@@ -63,12 +63,13 @@ extern char *cifs_compose_mount_options(const char *sb_mountdata,extern int SendReceive (const unsigned int /* xid */ ,struct cifsSesInfo *,struct smb_hdr */* input */ ,struct smb_hdr */* out */ , -int */* bytes returned */ ,const int long_op); +int */* bytes returned */ ,const int long_op,bool );extern int SendReceiveNoRsp (const unsigned int xid,struct cifsSesInfo *ses,struct smb_hdr *in_buf,int flags);extern int SendReceive2 (const unsigned int /* xid */ ,struct cifsSesInfo *,struct kvec *,int /* nvec to send */ , -int */* type of buf returned */ ,const int flags); +int */* type of buf returned */ ,const int flags, +bool ); extern int SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *ptcon, struct smb_hdr *in_buf ,
fs/cifs/cifssmb.c +51 -48
381 lines not on this page · raw message
fs/cifs/connect.c +4 -1
@@ -1809,6 +1809,9 @@ cifs_get_tcon(struct cifsSesInfo *ses, struct smb_vol *volume_info) } } +if (volume_info->retry) + tcon->retry = volume_info->retry; +if (strchr (volume_info->UNC +3 ,'\\' ) ==NULL &&strchr (volume_info->UNC +3 ,'/' ) ==NULL ) {cERROR (1 ,"Missing share name" );
@@ -2807,7 +2810,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, pSMB->ByteCount =cpu_to_le16 (count); rc =SendReceive (xid, ses, smb_buffer, smb_buffer_response, &length, -CIFS_STD_OP ); +CIFS_STD_OP , false);/* above now done in SendReceive */ if ((rc ==0 ) && (tcon !=NULL )) {
fs/cifs/sess.c +1 -1
@@ -866,7 +866,7 @@ ssetup_ntlmssp_authenticate:BCC_LE (smb_buf) =cpu_to_le16 (count); rc =SendReceive2 (xid, ses, iov,3 /* num_iovecs */ , &resp_buf_type, -CIFS_STD_OP /* not long */ |CIFS_LOG_ERROR ); +CIFS_STD_OP /* not long */ |CIFS_LOG_ERROR , false);/* SMB request buf freed in SendReceive2 */ cFYI (1 ,"ssetup rc from sendrecv2 is %d" , rc);
fs/cifs/transport.c +54 -6
102 lines not on this page · raw message
Signature · 1 line
1.6.0.2
Quoted 4 lines · On 05/26/2010 07:43 AM, [email protected] wrote:
From
13bc9a6e9808c6a12c26ef25ead8a70210e75bccMon Sep 17 00:00:00 2001
From: Shirish Pargaonkar <[email protected]>
Date: Tue, 25 May 2010 21:07:24 -0500
Subject: [PATCH] add support for implementing hard mount option behaviour
First of, I think the hard mounts behavior for cifs is not well defined and documented. Along with a descriptive changelog that explains the past and the behavior this patch introduces would help.
For e.g. whether the requests are retried indefinitely or not (nfs usually retries indefinitely) or have a timeout, are they interruptible or not, are there specific calls which are always soft/hard etc.
I think the mount.cifs man page section explaining 'hard' option also badly needs an update (possible mentioning when hard is recommended/useful). In current form, I think it is not clear when and why one should use soft/hard mounts.
Quoted 36 lines
Signed-off-by Shirish Pargaonkar <[email protected]>--- fs/cifs/cifsproto.h | 5 ++- fs/cifs/cifssmb.c | 99 ++++++++++++++++++++++++++------------------------ fs/cifs/connect.c | 5 ++- fs/cifs/sess.c | 2 +- fs/cifs/transport.c | 60 ++++++++++++++++++++++++++++--- 5 files changed, 113 insertions(+), 58 deletions(-)fs/cifs/connect.c +3
-0@@ -1809,6 +1809,9 @@ cifs_get_tcon(struct cifsSesInfo *ses, struct smb_vol *volume_info) } } +if (volume_info->retry) + tcon->retry = volume_info->retry; +if (strchr (volume_info->UNC +3 ,'\\' ) ==NULL &&strchr (volume_info->UNC +3 ,'/' ) ==NULL ) {cERROR (1 ,"Missing share name" );fs/cifs/transport.c +4
-0@@ -311,6 +311,44 @@ static int allocate_mid(struct cifsSesInfo *ses, struct smb_hdr *in_buf,return 0 ; } +static int +wait_for_response_hard (struct cifsSesInfo *ses,struct mid_q_entry *midQ) +{ +int rc;
fs/cifs/transport.c static int allocate_mid(struct cifsSesInfo *ses, struct smb_hdr *in_buf, · line 327
Quoted 10 lines
fs/cifs/transport.c +10
-0+bool cmdresp = true; +unsigned long timeout =60 *HZ ; +unsigned long curr_timeout; + +wait_again: + curr_timeout = timeout + jiffies; + rc =wait_event_interruptible_timeout (ses->server->response_q, + (midQ->midState !=MID_REQUEST_SUBMITTED ), timeout); + +if (rc <0 ) {
IIRC, the earlier post checked for only -ERESTARTSYS. Just curious what caused this change and why the earlier check was not sufficient?
fs/cifs/transport.c static int allocate_mid(struct cifsSesInfo *ses, struct smb_hdr *in_buf, · line 336
Quoted 9 lines
fs/cifs/transport.c +9
-0+cFYI (1 ,"command 0x%x interrupted" , midQ->command); +return -1 ; + } +if (!time_before (jiffies, curr_timeout)) { + cmdresp = false; +cFYI (1 ,"server not responding..." ); + goto wait_again; + } +spin_lock (&GlobalMid_Lock);
Do we really need to acquire the lock here?
fs/cifs/transport.c static int allocate_mid(struct cifsSesInfo *ses, struct smb_hdr *in_buf, · line 340
Quoted 4 lines
fs/cifs/transport.c +4
-0+if (midQ->midState !=MID_REQUEST_SUBMITTED ) { +if (midQ->midState ==MID_RESPONSE_RECEIVED ) { +if (!cmdresp) +cFYI (1 ,"server is ok..." );
The cFYI message could be little more useful..
fs/cifs/transport.c static int allocate_mid(struct cifsSesInfo *ses, struct smb_hdr *in_buf, · line 351
Quoted 11 lines
fs/cifs/transport.c +11
-0+ rc =0 ; + }else { +cFYI (1 ,"command 0x%x aborted" , midQ->command); + rc =-1 ; + } + } +spin_unlock (&GlobalMid_Lock); +return rc; +} + +
Thanks,
Signature · 1 line
Suresh Jayaraman