<br><br>
<div class="gmail_quote">On Fri, Sep 11, 2009 at 8:43 AM, Jeff Layton <span dir="ltr"><<a href="mailto:jlayton@redhat.com">jlayton@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>
<div></div>
<div class="h5">On Wed, 9 Sep 2009 03:40:13 -0500<br>Shirish Pargaonkar <<a href="mailto:shirishpargaonkar@gmail.com">shirishpargaonkar@gmail.com</a>> wrote:<br><br>> - Enable such that partial/shorts sends can be resent/retried_for_send<br>
> - Keep the midQ entry by marking it for resend/retry_sending in case<br>> of EAGAIN error<br>><br>><br>> diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c<br>> index 1da4ab2..92fa1ad 100644<br>> --- a/fs/cifs/transport.c<br>
> +++ b/fs/cifs/transport.c<br>> @@ -269,6 +269,7 @@ smb_sendv(struct TCP_Server_Info *server, struct<br>> kvec *iov, int n_vec)<br>> to kill the socket so the server throws away the partial<br>
> SMB */<br>> server->tcpStatus = CifsNeedReconnect;<br>> + rc = -EAGAIN;<br>> }<br>><br>> if (rc < 0) {<br>> @@ -505,8 +506,13 @@ SendReceive2(const unsigned int xid, struct<br>
> cifsSesInfo *ses,<br>> mutex_unlock(&ses->server->srv_mutex);<br>> cifs_small_buf_release(in_buf);<br>><br>> - if (rc < 0)<br>> - goto out;<br>> + if (rc < 0) {<br>
> + if (rc == -EAGAIN) {<br>> + midQ->midState = MID_RETRY_NEEDED;<br>> + goto outagain;<br>> + } else<br>> + goto out;<br>
> + }<br>><br>> if (long_op == CIFS_STD_OP)<br>> timeout = 15 * HZ;<br>> @@ -623,6 +629,7 @@ SendReceive2(const unsigned int xid, struct<br>> cifsSesInfo *ses,<br>><br>> out:<br>
> DeleteMidQEntry(midQ);<br>> +outagain:<br>> atomic_dec(&ses->server->inFlight);<br>> wake_up(&ses->server->request_q);<br>><br>> @@ -697,8 +704,13 @@ SendReceive(const unsigned int xid, struct<br>
> cifsSesInfo *ses,<br>> #endif<br>> mutex_unlock(&ses->server->srv_mutex);<br>><br>> - if (rc < 0)<br>> - goto out;<br>> + if (rc < 0) {<br>> + if (rc == -EAGAIN) {<br>
> + midQ->midState = MID_RETRY_NEEDED;<br>> + goto outagain;<br>> + } else<br>> + goto out;<br>> + }<br>><br>> if (long_op == CIFS_STD_OP)<br>
> timeout = 15 * HZ;<br>> @@ -807,6 +819,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,<br>><br>> out:<br>> DeleteMidQEntry(midQ);<br>> +outagain:<br>> atomic_dec(&ses->server->inFlight);<br>
> wake_up(&ses->server->request_q);<br><br></div></div>Patch looks reasonably sane. Could you outline what problem this is<br>intended to solve?<br><br>Also what about SendReceiveBlockingLock? Doesn't it need a similar<br>
change?<br><font color="#888888"><br>--<br>Jeff Layton <<a href="mailto:jlayton@redhat.com">jlayton@redhat.com</a>><br></font></blockquote></div>
<div> </div>
<div> </div>
<div>When a command is partially sent, cifs reconnects, so the partially sent command</div>
<div>needs to be re-sent, so then we want to percolate up that error so we can retry the</div>
<div>command above SendReceivexxx (not sure yet where exactly above).</div>
<div> </div>
<div>I did not see in test runs a locking operation returning with EAGAIN error. Actually</div>
<div>EAGAIN is more likely to occurr during large sends but it is safer to handle</div>
<div>(percolate up for retry) EAGAIN in SendReceive and SendReceiveBlockingLock.</div>
<div> </div>
<div>
<div>Handling egain in SendReceiveBlockingLock too. Here is the respin.</div></div>
<div> </div>
<div>signed-off-by: Shirish Pargaonkar <<a href="mailto:shirishpargaonkar@gmail.com">shirishpargaonkar@gmail.com</a>></div>
<div> </div>
<div> </div>
<div>diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c<br>index 1da4ab2..61b7a58 100644<br>--- a/fs/cifs/transport.c<br>+++ b/fs/cifs/transport.c<br>@@ -269,6 +269,7 @@ smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec)<br>
to kill the socket so the server throws away the partial<br> SMB */<br> server->tcpStatus = CifsNeedReconnect;<br>+ rc = -EAGAIN;<br> }</div>
<div> if (rc < 0) {<br>@@ -505,8 +506,13 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,<br> mutex_unlock(&ses->server->srv_mutex);<br> cifs_small_buf_release(in_buf);</div>
<div>- if (rc < 0)<br>- goto out;<br>+ if (rc < 0) {<br>+ if (rc == -EAGAIN) {<br>+ midQ->midState = MID_RETRY_NEEDED;<br>+ goto outagain;<br>
+ } else<br>+ goto out;<br>+ }</div>
<div> if (long_op == CIFS_STD_OP)<br> timeout = 15 * HZ;<br>@@ -623,6 +629,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,</div>
<div> out:<br> DeleteMidQEntry(midQ);<br>+outagain:<br> atomic_dec(&ses->server->inFlight);<br> wake_up(&ses->server->request_q);</div>
<div>@@ -697,8 +704,13 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,<br> #endif<br> mutex_unlock(&ses->server->srv_mutex);</div>
<div>- if (rc < 0)<br>- goto out;<br>+ if (rc < 0) {<br>+ if (rc == -EAGAIN) {<br>+ midQ->midState = MID_RETRY_NEEDED;<br>+ goto outagain;<br>
+ } else<br>+ goto out;<br>+ }</div>
<div> if (long_op == CIFS_STD_OP)<br> timeout = 15 * HZ;<br>@@ -807,6 +819,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,</div>
<div> out:<br> DeleteMidQEntry(midQ);<br>+outagain:<br> atomic_dec(&ses->server->inFlight);<br> wake_up(&ses->server->request_q);</div>
<div>@@ -931,7 +944,10 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,<br> mutex_unlock(&ses->server->srv_mutex);</div>
<div> if (rc < 0) {<br>- DeleteMidQEntry(midQ);<br>+ if (rc == -EAGAIN)<br>+ midQ->midState = MID_RETRY_NEEDED;<br>+ else<br>+ DeleteMidQEntry(midQ);<br>
return rc;<br> }<br></div>
<div><br> </div>