linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Shilovsky <piastryyy@gmail.com>
To: Shyam Prasad N <nspmangalore@gmail.com>
Cc: "Steve French" <smfrench@gmail.com>,
	"ronnie sahlberg" <ronniesahlberg@gmail.com>,
	"Paulo Alcantara" <pc@cjr.nz>, "Aurélien Aptel" <aaptel@suse.com>,
	"Ronnie Sahlberg" <lsahlber@redhat.com>,
	linux-cifs <linux-cifs@vger.kernel.org>
Subject: Re: [PATCH] cifs: do not fail __smb_send_rqst if non-fatal signals are pending
Date: Tue, 26 Jan 2021 15:17:39 -0800	[thread overview]
Message-ID: <CAKywueQiB__NmPqv0Q7OmGLqLRLShoQmoxELyFdBEANJz3GY1Q@mail.gmail.com> (raw)
In-Reply-To: <CANT5p=o5pjCLUzLv2=i+T+7XE=0Wxcg3p_TSbAeARAWNzmmgEw@mail.gmail.com>

пн, 25 янв. 2021 г. в 08:39, Shyam Prasad N <nspmangalore@gmail.com>:
>
> Hi Pavel,
>
> Sorry for the late review on this. A few minor comments on __smb_send_rqst():
>
>     if ((total_len > 0) && (total_len != send_length)) { <<<< what's
> special about total_len == 0? I'm guessing send_length will also be 0
> in such a case.


Should be. I don't think there should be a case of sending zero-length SMBs.


>         cifs_dbg(FYI, "partial send (wanted=%u sent=%zu): terminating
> session\n",
>              send_length, total_len);
>         /*
>          * If we have only sent part of an SMB then the next SMB could
>          * be taken as the remainder of this one. We need to kill the
>          * socket so the server throws away the partial SMB
>          */
>         server->tcpStatus = CifsNeedReconnect;
>         trace_smb3_partial_send_reconnect(server->CurrentMid,
>                           server->hostname);
>     }
>
> I'm not an expert on kernel socket programming, but if total_len !=
> sent_length, shouldn't we iterate retrying till they become equal (or
> abort if there's no progress)?

Given that this is a blocking send, total_len != send_length may
happen for several reasons: tcp buffers are full and signal is pending
or a connection is reset or closed.

> I see that we cork the connection before send, and I guess it's
> unlikely why only a partial write will occur (Since these are just
> in-memory writes).

For the reasons mentioned above partial send may occur any time.

> But what is the reason for reconnecting on partial writes?

partially sent SMBs would mean corrupted packets on the server and the
server will close the connection anyway.

>
> smbd_done:
>     if (rc < 0 && rc != -EINTR)   <<<<< Not very critical, but
> shouldn't we also check for rc != -ERESTARTSYS?

It doesn't seem like ERESTARTSYS may occur above but not 100% sure
here - needs investigations.


>         cifs_server_dbg(VFS, "Error %d sending data on socket to server\n",
>              rc);
>     else if (rc > 0)
>         rc = 0;
>
>     return rc;
> }
>
> Regards,
> Shyam



--
Best regards,
Pavel Shilovsky

  parent reply	other threads:[~2021-01-27  7:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210120043209.27786-1-lsahlber@redhat.com>
2021-01-20  6:19 ` [PATCH] cifs: do not fail __smb_send_rqst if non-fatal signals are pending Steve French
2021-01-20 17:30   ` Pavel Shilovsky
2021-01-21 10:11     ` Aurélien Aptel
2021-01-21 12:16       ` Paulo Alcantara
2021-01-21 17:11         ` Pavel Shilovsky
     [not found]         ` <CAN05THQjj04sQpcjvLqs+fmbdeu=jftM+GdeJnQMg33OEq6xEg@mail.gmail.com>
2021-01-22 19:47           ` Pavel Shilovsky
2021-01-22 21:45             ` ronnie sahlberg
2021-01-23  7:32               ` Steve French
2021-01-25 16:38                 ` Shyam Prasad N
2021-01-25 17:06                   ` Shyam Prasad N
2021-01-25 17:21                     ` Shyam Prasad N
2021-01-26 23:19                       ` Pavel Shilovsky
2021-01-26 23:34                     ` Pavel Shilovsky
2021-01-26 23:57                       ` ronnie sahlberg
2021-01-27 19:51                         ` Pavel Shilovsky
2021-01-26 23:17                   ` Pavel Shilovsky [this message]
     [not found] <20210120222248.22994-1-lsahlber@redhat.com>
2021-01-21  0:52 ` Steve French

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKywueQiB__NmPqv0Q7OmGLqLRLShoQmoxELyFdBEANJz3GY1Q@mail.gmail.com \
    --to=piastryyy@gmail.com \
    --cc=aaptel@suse.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=lsahlber@redhat.com \
    --cc=nspmangalore@gmail.com \
    --cc=pc@cjr.nz \
    --cc=ronniesahlberg@gmail.com \
    --cc=smfrench@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).