An error occurred fetching the project authors.
  1. 01 Apr, 2019 1 commit
    • Steve French's avatar
      SMB3: Allow persistent handle timeout to be configurable on mount · ca567eb2
      Steve French authored
      Reconnecting after server or network failure can be improved
      (to maintain availability and protect data integrity) by allowing
      the client to choose the default persistent (or resilient)
      handle timeout in some use cases.  Today we default to 0 which lets
      the server pick the default timeout (usually 120 seconds) but this
      can be problematic for some workloads.  Add the new mount parameter
      to cifs.ko for SMB3 mounts "handletimeout" which enables the user
      to override the default handle timeout for persistent (mount
      option "persistenthandles") or resilient handles (mount option
      "resilienthandles").  Maximum allowed is 16 minutes (960000 ms).
      Units for the timeout are expressed in milliseconds. See
      section 2.2.14.2.12 and 2.2.31.3 of the MS-SMB2 protocol
      specification for more information.
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Reviewed-by: default avatarPavel Shilovsky <pshilov@microsoft.com>
      Reviewed-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
      CC: Stable <stable@vger.kernel.org>
      ca567eb2
  2. 15 Mar, 2019 1 commit
  3. 06 Mar, 2019 2 commits
  4. 05 Mar, 2019 5 commits
    • Pavel Shilovsky's avatar
      CIFS: Count SMB3 credits for malformed pending responses · 66265f13
      Pavel Shilovsky authored
      Even if a response is malformed, we should count credits
      granted by the server to avoid miscalculations and unnecessary
      reconnects due to client or server bugs. If the response has
      been received partially, the session will be reconnected anyway
      on the next iteration of the demultiplex thread, so counting
      credits for such cases shouldn't break things.
      Signed-off-by: default avatarPavel Shilovsky <pshilov@microsoft.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      66265f13
    • Steve French's avatar
      smb3: make default i/o size for smb3 mounts larger · e8506d25
      Steve French authored
      We negotiate rsize mounts (and it can be overridden by user) to
      typically 4MB, so using larger default I/O sizes from userspace
      (changing to 1MB default i/o size returned by stat) the
      performance is much better (and not just for long latency
      network connections) in most use cases for SMB3 than the default I/O
      size (which ends up being 128K for cp and can be even smaller for cp).
      This can be 4x slower or worse depending on network latency.
      
      By changing inode->blocksize from 32K (which was perhaps ok
      for very old SMB1/CIFS) to a larger value, 1MB (but still less than
      max size negotiated with the server which is 4MB, in order to minimize
      risk) it significantly increases performance for the
      noncached case, and slightly increases it for the cached case.
      This can be changed by the user on mount (specifying bsize=
      values from 16K to 16MB) to tune better for performance
      for applications that depend on blocksize.
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Reviewed-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
      CC: Stable <stable@vger.kernel.org>
      e8506d25
    • Ronnie Sahlberg's avatar
      cifs: add credits from unmatched responses/messages · eca00452
      Ronnie Sahlberg authored
      We should add any credits granted to us from unmatched server responses.
      Signed-off-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Reviewed-by: default avatarPavel Shilovsky <pshilov@microsoft.com>
      eca00452
    • Ronnie Sahlberg's avatar
      cifs: replace snprintf with scnprintf · 74ea5f98
      Ronnie Sahlberg authored
      a trivial patch that replaces all use of snprintf with scnprintf.
      scnprintf() is generally seen as a safer function to use than
      snprintf for many use cases.
      
      In our case, there is no actual difference between the two since we never
      look at the return value. Thus we did not have any of the bugs that
      scnprintf protects against and the patch does nothing.
      
      However, for people reading our code it will be a receipt that we
      have done our due dilligence and checked our code for this type of bugs.
      
      See the presentation "Making C Less Dangerous In The Linux Kernel"
      at this years LCA
      Signed-off-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      74ea5f98
    • Yao Liu's avatar
      cifs: Fix NULL pointer dereference of devname · 68e2672f
      Yao Liu authored
      There is a NULL pointer dereference of devname in strspn()
      
      The oops looks something like:
      
        CIFS: Attempting to mount (null)
        BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
        ...
        RIP: 0010:strspn+0x0/0x50
        ...
        Call Trace:
         ? cifs_parse_mount_options+0x222/0x1710 [cifs]
         ? cifs_get_volume_info+0x2f/0x80 [cifs]
         cifs_setup_volume_info+0x20/0x190 [cifs]
         cifs_get_volume_info+0x50/0x80 [cifs]
         cifs_smb3_do_mount+0x59/0x630 [cifs]
         ? ida_alloc_range+0x34b/0x3d0
         cifs_do_mount+0x11/0x20 [cifs]
         mount_fs+0x52/0x170
         vfs_kern_mount+0x6b/0x170
         do_mount+0x216/0xdc0
         ksys_mount+0x83/0xd0
         __x64_sys_mount+0x25/0x30
         do_syscall_64+0x65/0x220
         entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      Fix this by adding a NULL check on devname in cifs_parse_devname()
      Signed-off-by: default avatarYao Liu <yotta.liu@ucloud.cn>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      68e2672f
  5. 24 Jan, 2019 1 commit
  6. 10 Jan, 2019 1 commit
  7. 03 Jan, 2019 1 commit
  8. 28 Dec, 2018 8 commits
  9. 24 Dec, 2018 5 commits
  10. 24 Oct, 2018 4 commits
  11. 23 Oct, 2018 1 commit
    • David Howells's avatar
      iov_iter: Separate type from direction and use accessor functions · aa563d7b
      David Howells authored
      In the iov_iter struct, separate the iterator type from the iterator
      direction and use accessor functions to access them in most places.
      
      Convert a bunch of places to use switch-statements to access them rather
      then chains of bitwise-AND statements.  This makes it easier to add further
      iterator types.  Also, this can be more efficient as to implement a switch
      of small contiguous integers, the compiler can use ~50% fewer compare
      instructions than it has to use bitwise-and instructions.
      
      Further, cease passing the iterator type into the iterator setup function.
      The iterator function can set that itself.  Only the direction is required.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      aa563d7b
  12. 02 Oct, 2018 2 commits
  13. 03 Sep, 2018 1 commit
  14. 10 Aug, 2018 1 commit
  15. 07 Aug, 2018 4 commits
  16. 05 Jul, 2018 1 commit
    • Lars Persson's avatar
      cifs: Fix use after free of a mid_q_entry · 696e420b
      Lars Persson authored
      With protocol version 2.0 mounts we have seen crashes with corrupt mid
      entries. Either the server->pending_mid_q list becomes corrupt with a
      cyclic reference in one element or a mid object fetched by the
      demultiplexer thread becomes overwritten during use.
      
      Code review identified a race between the demultiplexer thread and the
      request issuing thread. The demultiplexer thread seems to be written
      with the assumption that it is the sole user of the mid object until
      it calls the mid callback which either wakes the issuer task or
      deletes the mid.
      
      This assumption is not true because the issuer task can be woken up
      earlier by a signal. If the demultiplexer thread has proceeded as far
      as setting the mid_state to MID_RESPONSE_RECEIVED then the issuer
      thread will happily end up calling cifs_delete_mid while the
      demultiplexer thread still is using the mid object.
      
      Inserting a delay in the cifs demultiplexer thread widens the race
      window and makes reproduction of the race very easy:
      
      		if (server->large_buf)
      			buf = server->bigbuf;
      
      +		usleep_range(500, 4000);
      
      		server->lstrp = jiffies;
      
      To resolve this I think the proper solution involves putting a
      reference count on the mid object. This patch makes sure that the
      demultiplexer thread holds a reference until it has finished
      processing the transaction.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarLars Persson <larper@axis.com>
      Acked-by: default avatarPaulo Alcantara <palcantara@suse.de>
      Reviewed-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
      Reviewed-by: default avatarPavel Shilovsky <pshilov@microsoft.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      696e420b
  17. 15 Jun, 2018 1 commit