This patchset targets several problems related to credits and error handling happening on TCP reconnects. The following key points have been addressed: 1. Added coupling between credits and a TCP session, so credits don’t “move” between sessions. 2. Fixed credit handling for compounded requests. 3. Found and fixed many places where the client skips credits granted by the server. 4. Fixed handling of incomplete responses (due to network reconnects, partial receive, etc). 5. Fixed error paths in IO, so the client returns proper errors to the user space. 6. Fixed signal handling when sending packets though the network to avoid sending incomplete packets and breaking SMB session. 7. Fixed some memory and page cache related problems (null-pointer dereferences, memory leaks and leaving locked cache pages). 8. Improved logging and stats to help maintenance and support. The first 5 patches are marked for stable. Reviews are welcome. Pavel Shilovsky (23): CIFS: Fix possible oops and memory leaks in async IO CIFS: Fix trace command logging for SMB2 reads and writes CIFS: Do not count -ENODATA as failure for query directory CIFS: Do not consider -ENODATA as stat failure for reads CIFS: Fix leaking locked VFS cache pages in writeback retry CIFS: Always reset read error to -EIO if no response CIFS: Do not log credits when unmounting a share CIFS: Count SMB3 credits for malformed pending responses CIFS: Respect SMB2 hdr preamble size in read responses CIFS: Mask signals during sock_sendmsg() CIFS: Set reconnect instance to one initially CIFS: Respect reconnect in MTU credits calculations CIFS: Respect reconnect in non-MTU credits calculations CIFS: Check for reconnects before sending async requests CIFS: Check for reconnects before sending compound requests CIFS: Adjust MTU credits before reopening a file CIFS: Remove custom credit adjustments for SMB2 async IO CIFS: Reopen file before get SMB2 MTU credits for async IO CIFS: Find and reopen a file before get MTU credits in writepages CIFS: Move unlocking pages from wdata_send_pages() CIFS: Move open file handling to writepages CIFS: Return error code when getting file handle for writeback CIFS: Try to acquire credits at once for compound requests fs/cifs/cifsglob.h | 45 ++++++--- fs/cifs/cifsproto.h | 8 +- fs/cifs/cifssmb.c | 48 ++++++---- fs/cifs/connect.c | 7 +- fs/cifs/file.c | 266 ++++++++++++++++++++++++++++++++++++---------------- fs/cifs/smb1ops.c | 6 +- fs/cifs/smb2ops.c | 77 ++++++++++++--- fs/cifs/smb2pdu.c | 144 ++++++++++++++-------------- fs/cifs/transport.c | 191 ++++++++++++++++++++++++++++++------- 9 files changed, 555 insertions(+), 237 deletions(-) -- 2.7.4