[00/15] Improve credits handling on reconnects
mbox series

Message ID 1548277845-6746-1-git-send-email-pshilov@microsoft.com
Headers show
  • Improve credits handling on reconnects
Related show


Pavel Shilovsky Jan. 23, 2019, 9:10 p.m. UTC
This patch set aims to fix several issues with reconnect handling
mostly related to credits. The first 6 patches are targeted for
the current v5.0-rc kernel, the rest of the series is for v5.1.

A brief description of patches:
1) fix possible segfaults on reconnect because we were calling cifs_reconnect() from places where it shouldn't be called.
2-3) fix missing credits on normal read responses with errors.
4) account for credits for malformed requests (we still have Credit Granted field) and always add 1 credit back for SMB1.
5) do not mistakenly count 1 credit per unreceived response for SMB2 async commands.
6) use cached root handle to query attributes.
7-9) minor read handling fixes
10) do not interrupt network send even if we receive a signal because it will break SMB session.
11-13) tie credits and TCP session it belongs to (reconnect isntance number) to fix credit handling on reconnects.
14-15) add extra checks just before sending SMB packets to insure we are using credits for the current TCP session.

Reviews are welcome!

Pavel Shilovsky (15):
  CIFS: Do not reconnect TCP session in add_credits()
  CIFS: Fix credits calculations for reads with errors
  CIFS: Fix credit calculation for encrypted reads with errors
  CIFS: Fix credit calculations in compound mid callback
  CIFS: Do not assume one credit for async responses
  CIFS: Fix mounts if the client is low on credits
  CIFS: Always reset read error to -EIO if no response
  CIFS: Do not consider -ENODATA as stat failure for reads
  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

 fs/cifs/cifsglob.h  |  29 ++++++----
 fs/cifs/cifsproto.h |   5 +-
 fs/cifs/cifssmb.c   |  51 +++++++++++------
 fs/cifs/connect.c   |  26 ++++++++-
 fs/cifs/file.c      |  62 ++++++++++++--------
 fs/cifs/smb1ops.c   |   6 +-
 fs/cifs/smb2inode.c |  17 ++++++
 fs/cifs/smb2ops.c   |  86 +++++++++++++++++++---------
 fs/cifs/smb2pdu.c   |  88 ++++++++++++++++++++---------
 fs/cifs/transport.c | 159 ++++++++++++++++++++++++++++++++++++++++------------
 10 files changed, 378 insertions(+), 151 deletions(-)