пн, 25 янв. 2021 г. в 08:39, Shyam Prasad N <nspmangalore@xxxxxxxxx>: > > 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