<br><br>
<div class="gmail_quote">On Fri, Sep 11, 2009 at 8:43 AM, Jeff Layton <span dir="ltr">&lt;<a href="mailto:jlayton@redhat.com">jlayton@redhat.com</a>&gt;</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 &lt;<a href="mailto:shirishpargaonkar@gmail.com">shirishpargaonkar@gmail.com</a>&gt; wrote:<br><br>&gt; - Enable such that partial/shorts sends can be resent/retried_for_send<br>
&gt; - Keep the midQ entry by marking it for resend/retry_sending in case<br>&gt; of EAGAIN error<br>&gt;<br>&gt;<br>&gt; diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c<br>&gt; index 1da4ab2..92fa1ad 100644<br>&gt; --- a/fs/cifs/transport.c<br>
&gt; +++ b/fs/cifs/transport.c<br>&gt; @@ -269,6 +269,7 @@ smb_sendv(struct TCP_Server_Info *server, struct<br>&gt; kvec *iov, int n_vec)<br>&gt;                    to kill the socket so the server throws away the partial<br>
&gt;                    SMB */<br>&gt;                 server-&gt;tcpStatus = CifsNeedReconnect;<br>&gt; +               rc = -EAGAIN;<br>&gt;         }<br>&gt;<br>&gt;         if (rc &lt; 0) {<br>&gt; @@ -505,8 +506,13 @@ SendReceive2(const unsigned int xid, struct<br>
&gt; cifsSesInfo *ses,<br>&gt;         mutex_unlock(&amp;ses-&gt;server-&gt;srv_mutex);<br>&gt;         cifs_small_buf_release(in_buf);<br>&gt;<br>&gt; -       if (rc &lt; 0)<br>&gt; -               goto out;<br>&gt; +       if (rc &lt; 0) {<br>
&gt; +               if (rc == -EAGAIN) {<br>&gt; +                       midQ-&gt;midState = MID_RETRY_NEEDED;<br>&gt; +                       goto outagain;<br>&gt; +               } else<br>&gt; +                       goto out;<br>
&gt; +       }<br>&gt;<br>&gt;         if (long_op == CIFS_STD_OP)<br>&gt;                 timeout = 15 * HZ;<br>&gt; @@ -623,6 +629,7 @@ SendReceive2(const unsigned int xid, struct<br>&gt; cifsSesInfo *ses,<br>&gt;<br>&gt;  out:<br>
&gt;         DeleteMidQEntry(midQ);<br>&gt; +outagain:<br>&gt;         atomic_dec(&amp;ses-&gt;server-&gt;inFlight);<br>&gt;         wake_up(&amp;ses-&gt;server-&gt;request_q);<br>&gt;<br>&gt; @@ -697,8 +704,13 @@ SendReceive(const unsigned int xid, struct<br>
&gt; cifsSesInfo *ses,<br>&gt;  #endif<br>&gt;         mutex_unlock(&amp;ses-&gt;server-&gt;srv_mutex);<br>&gt;<br>&gt; -       if (rc &lt; 0)<br>&gt; -               goto out;<br>&gt; +       if (rc &lt; 0) {<br>&gt; +               if (rc == -EAGAIN) {<br>
&gt; +                       midQ-&gt;midState = MID_RETRY_NEEDED;<br>&gt; +                       goto outagain;<br>&gt; +               } else<br>&gt; +                       goto out;<br>&gt; +       }<br>&gt;<br>&gt;         if (long_op == CIFS_STD_OP)<br>
&gt;                 timeout = 15 * HZ;<br>&gt; @@ -807,6 +819,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,<br>&gt;<br>&gt;  out:<br>&gt;         DeleteMidQEntry(midQ);<br>&gt; +outagain:<br>&gt;         atomic_dec(&amp;ses-&gt;server-&gt;inFlight);<br>
&gt;         wake_up(&amp;ses-&gt;server-&gt;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&#39;t it need a similar<br>
change?<br><font color="#888888"><br>--<br>Jeff Layton &lt;<a href="mailto:jlayton@redhat.com">jlayton@redhat.com</a>&gt;<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 &lt;<a href="mailto:shirishpargaonkar@gmail.com">shirishpargaonkar@gmail.com</a>&gt;</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-&gt;tcpStatus = CifsNeedReconnect;<br>+               rc = -EAGAIN;<br>        }</div>
<div>        if (rc &lt; 0) {<br>@@ -505,8 +506,13 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,<br>        mutex_unlock(&amp;ses-&gt;server-&gt;srv_mutex);<br>        cifs_small_buf_release(in_buf);</div>

<div>-       if (rc &lt; 0)<br>-               goto out;<br>+       if (rc &lt; 0) {<br>+               if (rc == -EAGAIN) {<br>+                       midQ-&gt;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(&amp;ses-&gt;server-&gt;inFlight);<br>        wake_up(&amp;ses-&gt;server-&gt;request_q);</div>
<div>@@ -697,8 +704,13 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,<br> #endif<br>        mutex_unlock(&amp;ses-&gt;server-&gt;srv_mutex);</div>
<div>-       if (rc &lt; 0)<br>-               goto out;<br>+       if (rc &lt; 0) {<br>+               if (rc == -EAGAIN) {<br>+                       midQ-&gt;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(&amp;ses-&gt;server-&gt;inFlight);<br>        wake_up(&amp;ses-&gt;server-&gt;request_q);</div>
<div>@@ -931,7 +944,10 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,<br>        mutex_unlock(&amp;ses-&gt;server-&gt;srv_mutex);</div>
<div>        if (rc &lt; 0) {<br>-               DeleteMidQEntry(midQ);<br>+               if (rc == -EAGAIN)<br>+                       midQ-&gt;midState = MID_RETRY_NEEDED;<br>+               else<br>+                       DeleteMidQEntry(midQ);<br>
                return rc;<br>        }<br></div>
<div><br> </div>