An error occurred fetching the project authors.
  1. 25 Jun, 2019 1 commit
  2. 25 May, 2019 1 commit
  3. 16 Apr, 2019 1 commit
    • Aurelien Aptel's avatar
      CIFS: keep FileInfo handle live during oplock break · b98749ca
      Aurelien Aptel authored
      In the oplock break handler, writing pending changes from pages puts
      the FileInfo handle. If the refcount reaches zero it closes the handle
      and waits for any oplock break handler to return, thus causing a deadlock.
      
      To prevent this situation:
      
      * We add a wait flag to cifsFileInfo_put() to decide whether we should
        wait for running/pending oplock break handlers
      
      * We keep an additionnal reference of the SMB FileInfo handle so that
        for the rest of the handler putting the handle won't close it.
        - The ref is bumped everytime we queue the handler via the
          cifs_queue_oplock_break() helper.
        - The ref is decremented at the end of the handler
      
      This bug was triggered by xfstest 464.
      
      Also important fix to address the various reports of
      oops in smb2_push_mandatory_locks
      Signed-off-by: default avatarAurelien Aptel <aaptel@suse.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Reviewed-by: default avatarPavel Shilovsky <pshilov@microsoft.com>
      CC: Stable <stable@vger.kernel.org>
      b98749ca
  4. 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
  5. 15 Mar, 2019 4 commits
  6. 06 Mar, 2019 3 commits
  7. 05 Mar, 2019 3 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
    • Pavel Shilovsky's avatar
      CIFS: Do not skip SMB2 message IDs on send failures · c781af7e
      Pavel Shilovsky authored
      When we hit failures during constructing MIDs or sending PDUs
      through the network, we end up not using message IDs assigned
      to the packet. The next SMB packet will skip those message IDs
      and continue with the next one. This behavior may lead to a server
      not granting us credits until we use the skipped IDs. Fix this by
      reverting the current ID to the original value if any errors occur
      before we push the packet through the network stack.
      
      This patch fixes the generic/310 test from the xfs-tests.
      
      Cc: <stable@vger.kernel.org> # 4.19.x
      Signed-off-by: default avatarPavel Shilovsky <pshilov@microsoft.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      c781af7e
    • 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
  8. 11 Jan, 2019 2 commits
  9. 28 Dec, 2018 3 commits
    • Paulo Alcantara's avatar
      cifs: Add support for failover in cifs_reconnect() · 93d5cb51
      Paulo Alcantara authored
      After failing to reconnect to original target, it will retry any
      target available from DFS cache.
      Signed-off-by: default avatarPaulo Alcantara <palcantara@suse.de>
      Reviewed-by: default avatarAurelien Aptel <aaptel@suse.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      93d5cb51
    • Paulo Alcantara's avatar
      cifs: Make use of DFS cache to get new DFS referrals · 1c780228
      Paulo Alcantara authored
      This patch will make use of DFS cache routines where appropriate and
      do not always request a new referral from server.
      Signed-off-by: default avatarPaulo Alcantara <palcantara@suse.de>
      Reviewed-by: default avatarAurelien Aptel <aaptel@suse.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      1c780228
    • Paulo Alcantara's avatar
      cifs: Add DFS cache routines · 54be1f6c
      Paulo Alcantara authored
      * Add new dfs_cache.[ch] files
      
      * Add new /proc/fs/cifs/dfscache file
        - dump current cache when read
        - clear current cache when writing "0" to it
      
      * Add delayed_work to periodically refresh cache entries
      
      The new interface will be used for caching DFS referrals, as well as
      supporting client target failover.
      
      The DFS cache is a hashtable that maps UNC paths to cache entries.
      
      A cache entry contains:
      - the UNC path it is mapped on
      - how much the the UNC path the entry consumes
      - flags
      - a Time-To-Live after which the entry expires
      - a list of possible targets (linked lists of UNC paths)
      - a "hint target" pointing the last known working target or the first
        target if none were tried. This hint lets cifs.ko remember and try
        working targets first.
      
      * Looking for an entry in the cache is done with dfs_cache_find()
        - if no valid entries are found, a DFS query is made, stored in the
          cache and returned
        - the full target list can be copied and returned to avoid race
          conditions and looped on with the help with the
          dfs_cache_tgt_iterator
      
      * Updating the target hint to the next target is done with
        dfs_cache_update_tgthint()
      
      These functions have a dfs_cache_noreq_XXX() version that doesn't
      fetches referrals if no entries are found. These versions don't
      require the tcp/ses/tcon/cifs_sb parameters as a result.
      
      Expired entries cannot be used and since they have a pretty short TTL
      [1] in order for them to be useful for failover the DFS cache adds a
      delayed work called periodically to keep them fresh.
      
      Since we might not have available connections to issue the referral
      request when refreshing we need to store volume_info structs with
      credentials and other needed info to be able to connect to the right
      server.
      
      1: Windows defaults: 5mn for domain-based referrals, 30mn for regular
      links
      Signed-off-by: default avatarPaulo Alcantara <palcantara@suse.de>
      Signed-off-by: default avatarAurelien Aptel <aaptel@suse.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      54be1f6c
  10. 24 Dec, 2018 2 commits
  11. 02 Nov, 2018 2 commits
    • Long Li's avatar
      CIFS: Add support for direct I/O read · 6e6e2b86
      Long Li authored
      With direct I/O read, we transfer the data directly from transport layer to
      the user data buffer.
      
      Change in v3: add support for kernel AIO
      
      Change in v4:
      Refactor common read code to __cifs_readv for direct and non-direct I/O.
      Retry on direct I/O failure.
      Signed-off-by: default avatarLong Li <longli@microsoft.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      6e6e2b86
    • Steve French's avatar
      smb3: allow more detailed protocol info on open files for debugging · dfe33f9a
      Steve French authored
      In order to debug complex problems it is often helpful to
      have detailed information on the client and server view
      of the open file information.  Add the ability for root to
      view the list of smb3 open files and dump the persistent
      handle and other info so that it can be more easily
      correlated with server logs.
      
      Sample output from "cat /proc/fs/cifs/open_files"
      
       # Version:1
       # Format:
       # <tree id> <persistent fid> <flags> <count> <pid> <uid> <filename> <mid>
       0x5 0x800000378 0x8000 1 7704 0 some-file 0x14
       0xcb903c0c 0x84412e67 0x8000 1 7754 1001 rofile 0x1a6d
       0xcb903c0c 0x9526b767 0x8000 1 7720 1000 file 0x1a5b
       0xcb903c0c 0x9ce41a21 0x8000 1 7715 0 smallfile 0xd67
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Reviewed-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
      dfe33f9a
  12. 24 Oct, 2018 7 commits
  13. 02 Oct, 2018 1 commit
  14. 10 Aug, 2018 1 commit
  15. 07 Aug, 2018 7 commits
  16. 05 Jul, 2018 1 commit
    • Stefano Brivio's avatar
      cifs: Fix stack out-of-bounds in smb{2,3}_create_lease_buf() · 729c0c9d
      Stefano Brivio authored
      smb{2,3}_create_lease_buf() store a lease key in the lease
      context for later usage on a lease break.
      
      In most paths, the key is currently sourced from data that
      happens to be on the stack near local variables for oplock in
      SMB2_open() callers, e.g. from open_shroot(), whereas
      smb2_open_file() properly allocates space on its stack for it.
      
      The address of those local variables holding the oplock is then
      passed to create_lease_buf handlers via SMB2_open(), and 16
      bytes near oplock are used. This causes a stack out-of-bounds
      access as reported by KASAN on SMB2.1 and SMB3 mounts (first
      out-of-bounds access is shown here):
      
      [  111.528823] BUG: KASAN: stack-out-of-bounds in smb3_create_lease_buf+0x399/0x3b0 [cifs]
      [  111.530815] Read of size 8 at addr ffff88010829f249 by task mount.cifs/985
      [  111.532838] CPU: 3 PID: 985 Comm: mount.cifs Not tainted 4.18.0-rc3+ #91
      [  111.534656] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014
      [  111.536838] Call Trace:
      [  111.537528]  dump_stack+0xc2/0x16b
      [  111.540890]  print_address_description+0x6a/0x270
      [  111.542185]  kasan_report+0x258/0x380
      [  111.544701]  smb3_create_lease_buf+0x399/0x3b0 [cifs]
      [  111.546134]  SMB2_open+0x1ef8/0x4b70 [cifs]
      [  111.575883]  open_shroot+0x339/0x550 [cifs]
      [  111.591969]  smb3_qfs_tcon+0x32c/0x1e60 [cifs]
      [  111.617405]  cifs_mount+0x4f3/0x2fc0 [cifs]
      [  111.674332]  cifs_smb3_do_mount+0x263/0xf10 [cifs]
      [  111.677915]  mount_fs+0x55/0x2b0
      [  111.679504]  vfs_kern_mount.part.22+0xaa/0x430
      [  111.684511]  do_mount+0xc40/0x2660
      [  111.698301]  ksys_mount+0x80/0xd0
      [  111.701541]  do_syscall_64+0x14e/0x4b0
      [  111.711807]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      [  111.713665] RIP: 0033:0x7f372385b5fa
      [  111.715311] Code: 48 8b 0d 99 78 2c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 66 78 2c 00 f7 d8 64 89 01 48
      [  111.720330] RSP: 002b:00007ffff27049d8 EFLAGS: 00000206 ORIG_RAX: 00000000000000a5
      [  111.722601] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f372385b5fa
      [  111.724842] RDX: 000055c2ecdc73b2 RSI: 000055c2ecdc73f9 RDI: 00007ffff270580f
      [  111.727083] RBP: 00007ffff2705804 R08: 000055c2ee976060 R09: 0000000000001000
      [  111.729319] R10: 0000000000000000 R11: 0000000000000206 R12: 00007f3723f4d000
      [  111.731615] R13: 000055c2ee976060 R14: 00007f3723f4f90f R15: 0000000000000000
      
      [  111.735448] The buggy address belongs to the page:
      [  111.737420] page:ffffea000420a7c0 count:0 mapcount:0 mapping:0000000000000000 index:0x0
      [  111.739890] flags: 0x17ffffc0000000()
      [  111.741750] raw: 0017ffffc0000000 0000000000000000 dead000000000200 0000000000000000
      [  111.744216] raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
      [  111.746679] page dumped because: kasan: bad access detected
      
      [  111.750482] Memory state around the buggy address:
      [  111.752562]  ffff88010829f100: 00 f2 f2 f2 f2 f2 f2 f2 00 00 00 00 00 00 00 00
      [  111.754991]  ffff88010829f180: 00 00 f2 f2 00 00 00 00 00 00 00 00 00 00 00 00
      [  111.757401] >ffff88010829f200: 00 00 00 00 00 f1 f1 f1 f1 01 f2 f2 f2 f2 f2 f2
      [  111.759801]                                               ^
      [  111.762034]  ffff88010829f280: f2 02 f2 f2 f2 f2 f2 f2 f2 00 00 00 00 00 00 00
      [  111.764486]  ffff88010829f300: f2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [  111.766913] ==================================================================
      
      Lease keys are however already generated and stored in fid data
      on open and create paths: pass them down to the lease context
      creation handlers and use them.
      Suggested-by: default avatarAurélien Aptel <aaptel@suse.com>
      Reviewed-by: default avatarAurelien Aptel <aaptel@suse.com>
      Fixes: b8c32dbb ("CIFS: Request SMB2.1 leases")
      Signed-off-by: default avatarStefano Brivio <sbrivio@redhat.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      729c0c9d