1. 27 1月, 2020 4 次提交
  2. 13 12月, 2019 1 次提交
  3. 04 12月, 2019 1 次提交
    • S
      smb3: query attributes on file close · 43f8a6a7
      Steve French 提交于
      Since timestamps on files on most servers can be updated at
      close, and since timestamps on our dentries default to one
      second we can have stale timestamps in some common cases
      (e.g. open, write, close, stat, wait one second, stat - will
      show different mtime for the first and second stat).
      
      The SMB2/SMB3 protocol allows querying timestamps at close
      so add the code to request timestamp and attr information
      (which is cheap for the server to provide) to be returned
      when a file is closed (it is not needed for the many
      paths that call SMB2_close that are from compounded
      query infos and close nor is it needed for some of
      the cases where a directory close immediately follows a
      directory open.
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Acked-by: NRonnie Sahlberg <lsahlber@redhat.com>
      Reviewed-by: NAurelien Aptel <aaptel@suse.com>
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      43f8a6a7
  4. 25 11月, 2019 7 次提交
    • P
      CIFS: Properly process SMB3 lease breaks · 9bd45408
      Pavel Shilovsky 提交于
      Currenly we doesn't assume that a server may break a lease
      from RWH to RW which causes us setting a wrong lease state
      on a file and thus mistakenly flushing data and byte-range
      locks and purging cached data on the client. This leads to
      performance degradation because subsequent IOs go directly
      to the server.
      
      Fix this by propagating new lease state and epoch values
      to the oplock break handler through cifsFileInfo structure
      and removing the use of cifsInodeInfo flags for that. It
      allows to avoid some races of several lease/oplock breaks
      using those flags in parallel.
      Signed-off-by: NPavel Shilovsky <pshilov@microsoft.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      9bd45408
    • A
      cifs: try opening channels after mounting · d70e9fa5
      Aurelien Aptel 提交于
      After doing mount() successfully we call cifs_try_adding_channels()
      which will open as many channels as it can.
      
      Channels are closed when the master session is closed.
      
      The master connection becomes the first channel.
      
      ,-------------> global cifs_tcp_ses_list <-------------------------.
      |                                                                  |
      '- TCP_Server_Info  <-->  TCP_Server_Info  <-->  TCP_Server_Info <-'
            (master con)           (chan#1 con)         (chan#2 con)
            |      ^                    ^                    ^
            v      '--------------------|--------------------'
         cifs_ses                       |
         - chan_count = 3               |
         - chans[] ---------------------'
         - smb3signingkey[]
            (master signing key)
      
      Note how channel connections don't have sessions. That's because
      cifs_ses can only be part of one linked list (list_head are internal
      to the elements).
      
      For signing keys, each channel has its own signing key which must be
      used only after the channel has been bound. While it's binding it must
      use the master session signing key.
      
      For encryption keys, since channel connections do not have sessions
      attached we must now find matching session by looping over all sessions
      in smb2_get_enc_key().
      
      Each channel is opened like a regular server connection but at the
      session setup request step it must set the
      SMB2_SESSION_REQ_FLAG_BINDING flag and use the session id to bind to.
      
      Finally, while sending in compound_send_recv() for requests that
      aren't negprot, ses-setup or binding related, use a channel by cycling
      through the available ones (round-robin).
      Signed-off-by: NAurelien Aptel <aaptel@suse.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      d70e9fa5
    • A
      cifs: switch servers depending on binding state · f6a6bf7c
      Aurelien Aptel 提交于
      Currently a lot of the code to initialize a connection & session uses
      the cifs_ses as input. But depending on if we are opening a new session
      or a new channel we need to use different server pointers.
      
      Add a "binding" flag in cifs_ses and a helper function that returns
      the server ptr a session should use (only in the sess establishment
      code path).
      Signed-off-by: NAurelien Aptel <aaptel@suse.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      f6a6bf7c
    • A
      cifs: sort interface list by speed · 35adffed
      Aurelien Aptel 提交于
      New channels are going to be opened by walking the list sequentially,
      so by sorting it we will connect to the fastest interfaces first.
      Signed-off-by: NAurelien Aptel <aaptel@suse.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      35adffed
    • P
      CIFS: Fix NULL pointer dereference in mid callback · 86a7964b
      Pavel Shilovsky 提交于
      There is a race between a system call processing thread
      and the demultiplex thread when mid->resp_buf becomes NULL
      and later is being accessed to get credits. It happens when
      the 1st thread wakes up before a mid callback is called in
      the 2nd one but the mid state has already been set to
      MID_RESPONSE_RECEIVED. This causes NULL pointer dereference
      in mid callback.
      
      Fix this by saving credits from the response before we
      update the mid state and then use this value in the mid
      callback rather then accessing a response buffer.
      
      Cc: Stable <stable@vger.kernel.org>
      Fixes: ee258d79 ("CIFS: Move credit processing to mid callbacks for SMB3")
      Tested-by: NFrank Sorenson <sorenson@redhat.com>
      Reviewed-by: NRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: NPavel Shilovsky <pshilov@microsoft.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      86a7964b
    • M
      CIFS: Use common error handling code in smb2_ioctl_query_info() · 2b1116bb
      Markus Elfring 提交于
      Move the same error code assignments so that such exception handling
      can be better reused at the end of this function.
      
      This issue was detected by using the Coccinelle software.
      Signed-off-by: NMarkus Elfring <elfring@users.sourceforge.net>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      2b1116bb
    • M
      CIFS: Use memdup_user() rather than duplicating its implementation · cfaa1181
      Markus Elfring 提交于
      Reuse existing functionality from memdup_user() instead of keeping
      duplicate source code.
      
      Generated by: scripts/coccinelle/api/memdup_user.cocci
      
      Fixes: f5b05d62 ("cifs: add IOCTL for QUERY_INFO passthrough to userspace")
      Signed-off-by: NMarkus Elfring <elfring@users.sourceforge.net>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      cfaa1181
  5. 28 10月, 2019 1 次提交
  6. 27 9月, 2019 1 次提交
    • P
      CIFS: Fix oplock handling for SMB 2.1+ protocols · a016e279
      Pavel Shilovsky 提交于
      There may be situations when a server negotiates SMB 2.1
      protocol version or higher but responds to a CREATE request
      with an oplock rather than a lease.
      
      Currently the client doesn't handle such a case correctly:
      when another CREATE comes in the server sends an oplock
      break to the initial CREATE and the client doesn't send
      an ack back due to a wrong caching level being set (READ
      instead of RWH). Missing an oplock break ack makes the
      server wait until the break times out which dramatically
      increases the latency of the second CREATE.
      
      Fix this by properly detecting oplocks when using SMB 2.1
      protocol version and higher.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NPavel Shilovsky <pshilov@microsoft.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Reviewed-by: NRonnie Sahlberg <lsahlber@redhat.com>
      a016e279
  7. 24 9月, 2019 1 次提交
  8. 17 9月, 2019 10 次提交
  9. 06 8月, 2019 2 次提交
  10. 19 7月, 2019 2 次提交
  11. 16 7月, 2019 1 次提交
  12. 11 7月, 2019 1 次提交
  13. 08 7月, 2019 5 次提交
  14. 28 6月, 2019 1 次提交
    • R
      cifs: fix crash querying symlinks stored as reparse-points · 5de254dc
      Ronnie Sahlberg 提交于
      We never parsed/returned any data from .get_link() when the object is a windows reparse-point
      containing a symlink. This results in the VFS layer oopsing accessing an uninitialized buffer:
      
      ...
      [  171.407172] Call Trace:
      [  171.408039]  readlink_copy+0x29/0x70
      [  171.408872]  vfs_readlink+0xc1/0x1f0
      [  171.409709]  ? readlink_copy+0x70/0x70
      [  171.410565]  ? simple_attr_release+0x30/0x30
      [  171.411446]  ? getname_flags+0x105/0x2a0
      [  171.412231]  do_readlinkat+0x1b7/0x1e0
      [  171.412938]  ? __ia32_compat_sys_newfstat+0x30/0x30
      ...
      
      Fix this by adding code to handle these buffers and make sure we do return a valid buffer
      to .get_link()
      
      CC: Stable <stable@vger.kernel.org>
      Signed-off-by: NRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      5de254dc
  15. 19 6月, 2019 1 次提交
  16. 16 5月, 2019 1 次提交