1. 06 12月, 2016 1 次提交
    • P
      CIFS: Fix a possible memory corruption during reconnect · 53e0e11e
      Pavel Shilovsky 提交于
      We can not unlock/lock cifs_tcp_ses_lock while walking through ses
      and tcon lists because it can corrupt list iterator pointers and
      a tcon structure can be released if we don't hold an extra reference.
      Fix it by moving a reconnect process to a separate delayed work
      and acquiring a reference to every tcon that needs to be reconnected.
      Also do not send an echo request on newly established connections.
      
      CC: Stable <stable@vger.kernel.org>
      Signed-off-by: NPavel Shilovsky <pshilov@microsoft.com>
      53e0e11e
  2. 01 12月, 2016 1 次提交
    • S
      SMB3: parsing for new snapshot timestamp mount parm · 8b217fe7
      Steve French 提交于
      New mount option "snapshot=<time>" to allow mounting an earlier
      version of the remote volume (if such a snapshot exists on
      the server).
      
      Note that eventually specifying a snapshot time of 1 will allow
      the user to mount the oldest snapshot. A subsequent patch
      add the processing for that and another for actually specifying
      the "time warp" create context on SMB2/SMB3 open.
      
      Check to make sure SMB2 negotiated, and ensure that
      we use a different tcon if mount same share twice
      but with different snaphshot times
      Signed-off-by: NSteve French <smfrench@gmail.com>
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      8b217fe7
  3. 29 11月, 2016 1 次提交
  4. 15 10月, 2016 1 次提交
  5. 13 10月, 2016 3 次提交
  6. 10 9月, 2016 2 次提交
  7. 28 7月, 2016 1 次提交
  8. 20 7月, 2016 1 次提交
    • R
      cifs: unbreak TCP session reuse · b782fcc1
      Rabin Vincent 提交于
      adfeb3e0 ("cifs: Make echo interval tunable") added a comparison of
      vol->echo_interval to server->echo_interval as a criterium to
      match_server(), but:
      
       (1) A default value is set for server->echo_interval but not for
       vol->echo_interval, meaning these can never match if the echo_interval
       option is not specified.
      
       (2) vol->echo_interval is in seconds but server->echo_interval is in
       jiffies, meaning these can never match even if the echo_interval option
       is specified.
      
      This broke TCP session reuse since match_server() can never return 1.
      Fix it.
      
      Fixes: adfeb3e0 ("cifs: Make echo interval tunable")
      Signed-off-by: NRabin Vincent <rabinv@axis.com>
      Acked-by: NSachin Prabhu <sprabhu@redhat.com>
      CC: Stable <stable@vger.kernel.org>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      b782fcc1
  9. 25 6月, 2016 1 次提交
    • S
      Fix reconnect to not defer smb3 session reconnect long after socket reconnect · 4fcd1813
      Steve French 提交于
      Azure server blocks clients that open a socket and don't do anything on it.
      In our reconnect scenarios, we can reconnect the tcp session and
      detect the socket is available but we defer the negprot and SMB3 session
      setup and tree connect reconnection until the next i/o is requested, but
      this looks suspicous to some servers who expect SMB3 negprog and session
      setup soon after a socket is created.
      
      In the echo thread, reconnect SMB3 sessions and tree connections
      that are disconnected.  A later patch will replay persistent (and
      resilient) handle opens.
      
      CC: Stable <stable@vger.kernel.org>
      Signed-off-by: NSteve French <steve.french@primarydata.com>
      Acked-by: NPavel Shilovsky <pshilovsky@samba.org>
      4fcd1813
  10. 18 5月, 2016 1 次提交
    • S
      cifs: remove any preceding delimiter from prefix_path · 11e31647
      Sachin Prabhu 提交于
      We currently do not check if any delimiter exists before the prefix
      path in cifs_compose_mount_options(). Consequently when building the
      devname using cifs_build_devname() we can end up with multiple
      delimiters separating the UNC and the prefix path.
      
      An issue was reported by the customer mounting a folder within a DFS
      share from a Netapp server which uses McAfee antivirus. We have
      narrowed down the cause to the use of double backslashes in the file
      name used to open the file. This was determined to be caused because of
      additional delimiters as a result of the bug.
      
      In addition to changes in cifs_build_devname(), we also fix
      cifs_parse_devname() to ignore any preceding delimiter for the prefix
      path.
      
      The problem was originally reported on RHEL 6 in RHEL bz 1252721. This
      is the upstream version of the fix. The fix was confirmed by looking at
      the packet capture of a DFS mount.
      Signed-off-by: NSachin Prabhu <sprabhu@redhat.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      11e31647
  11. 14 4月, 2016 1 次提交
  12. 05 4月, 2016 1 次提交
    • K
      mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros · 09cbfeaf
      Kirill A. Shutemov 提交于
      PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
      ago with promise that one day it will be possible to implement page
      cache with bigger chunks than PAGE_SIZE.
      
      This promise never materialized.  And unlikely will.
      
      We have many places where PAGE_CACHE_SIZE assumed to be equal to
      PAGE_SIZE.  And it's constant source of confusion on whether
      PAGE_CACHE_* or PAGE_* constant should be used in a particular case,
      especially on the border between fs and mm.
      
      Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
      breakage to be doable.
      
      Let's stop pretending that pages in page cache are special.  They are
      not.
      
      The changes are pretty straight-forward:
      
       - <foo> << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
      
       - <foo> >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
      
       - PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN};
      
       - page_cache_get() -> get_page();
      
       - page_cache_release() -> put_page();
      
      This patch contains automated changes generated with coccinelle using
      script below.  For some reason, coccinelle doesn't patch header files.
      I've called spatch for them manually.
      
      The only adjustment after coccinelle is revert of changes to
      PAGE_CAHCE_ALIGN definition: we are going to drop it later.
      
      There are few places in the code where coccinelle didn't reach.  I'll
      fix them manually in a separate patch.  Comments and documentation also
      will be addressed with the separate patch.
      
      virtual patch
      
      @@
      expression E;
      @@
      - E << (PAGE_CACHE_SHIFT - PAGE_SHIFT)
      + E
      
      @@
      expression E;
      @@
      - E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT)
      + E
      
      @@
      @@
      - PAGE_CACHE_SHIFT
      + PAGE_SHIFT
      
      @@
      @@
      - PAGE_CACHE_SIZE
      + PAGE_SIZE
      
      @@
      @@
      - PAGE_CACHE_MASK
      + PAGE_MASK
      
      @@
      expression E;
      @@
      - PAGE_CACHE_ALIGN(E)
      + PAGE_ALIGN(E)
      
      @@
      expression E;
      @@
      - page_cache_get(E)
      + get_page(E)
      
      @@
      expression E;
      @@
      - page_cache_release(E)
      + put_page(E)
      Signed-off-by: NKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Acked-by: NMichal Hocko <mhocko@suse.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      09cbfeaf
  13. 29 3月, 2016 2 次提交
  14. 11 2月, 2016 1 次提交
  15. 15 1月, 2016 4 次提交
    • R
      cifs: fix race between call_async() and reconnect() · 820962dc
      Rabin Vincent 提交于
      cifs_call_async() queues the MID to the pending list and calls
      smb_send_rqst().  If smb_send_rqst() performs a partial send, it sets
      the tcpStatus to CifsNeedReconnect and returns an error code to
      cifs_call_async().  In this case, cifs_call_async() removes the MID
      from the list and returns to the caller.
      
      However, cifs_call_async() releases the server mutex _before_ removing
      the MID.  This means that a cifs_reconnect() can race with this function
      and manage to remove the MID from the list and delete the entry before
      cifs_call_async() calls cifs_delete_mid().  This leads to various
      crashes due to the use after free in cifs_delete_mid().
      
      Task1				Task2
      
      cifs_call_async():
       - rc = -EAGAIN
       - mutex_unlock(srv_mutex)
      
      				cifs_reconnect():
      				 - mutex_lock(srv_mutex)
      				 - mutex_unlock(srv_mutex)
      				 - list_delete(mid)
      				 - mid->callback()
      				 	cifs_writev_callback():
      				 		- mutex_lock(srv_mutex)
      						- delete(mid)
      				 		- mutex_unlock(srv_mutex)
      
       - cifs_delete_mid(mid) <---- use after free
      
      Fix this by removing the MID in cifs_call_async() before releasing the
      srv_mutex.  Also hold the srv_mutex in cifs_reconnect() until the MIDs
      are moved out of the pending list.
      Signed-off-by: NRabin Vincent <rabin.vincent@axis.com>
      Acked-by: NShirish Pargaonkar <shirishpargaonkar@gmail.com>
      CC: Stable <stable@vger.kernel.org>
      Signed-off-by: NSteve French <sfrench@localhost.localdomain>
      820962dc
    • S
      Prepare for encryption support (first part). Add decryption and encryption key... · 373512ec
      Steve French 提交于
      Prepare for encryption support (first part). Add decryption and encryption key generation. Thanks to Metze for helping with this.
      Reviewed-by: NStefan Metzmacher <metze@samba.org>
      Signed-off-by: NSteve French <steve.french@primarydata.com>
      373512ec
    • S
      cifs: Make echo interval tunable · adfeb3e0
      Steve French 提交于
      Currently the echo interval is set to 60 seconds using a macro. This
      setting determines the interval at which echo requests are sent to the
      server on an idling connection. This setting also affects the time
      required for a connection to an unresponsive server to timeout.
      
      Making this setting a tunable allows users to control the echo interval
      times as well as control the time after which the connecting to an
      unresponsive server times out.
      
      To set echo interval, pass the echo_interval=n mount option.
      
      Version four of the patch.
      v2: Change MIN and MAX timeout values
      v3: Remove incorrect comment in cifs_get_tcp_session
      v4: Fix bug in setting echo_intervalw
      Signed-off-by: NSachin Prabhu <sprabhu@redhat.com>
      Acked-by: NShirish Pargaonkar <shirishpargaonkar@gmail.com>
      adfeb3e0
    • A
      Print IP address of unresponsive server · 275516cd
      Arnd Hannemann 提交于
      Before this patch, only the hostname of the server
      is printed when it becomes unresponsive.
      This might not be helpful, if the IP-Address has
      changed since initial mount when the name was
      resolved (e.g. because the IPv6-Prefix changed).
      
      This patch adds the cached IP address of the unresponsive server,
      to the log message.
      Signed-off-by: NArnd Hannemann <arnd@arndnet.de>
      Signed-off-by: NSteve French <sfrench@localhost.localdomain>
      275516cd
  16. 04 11月, 2015 1 次提交
  17. 03 11月, 2015 2 次提交
  18. 21 10月, 2015 1 次提交
    • D
      KEYS: Merge the type-specific data with the payload data · 146aa8b1
      David Howells 提交于
      Merge the type-specific data with the payload data into one four-word chunk
      as it seems pointless to keep them separate.
      
      Use user_key_payload() for accessing the payloads of overloaded
      user-defined keys.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      cc: linux-cifs@vger.kernel.org
      cc: ecryptfs@vger.kernel.org
      cc: linux-ext4@vger.kernel.org
      cc: linux-f2fs-devel@lists.sourceforge.net
      cc: linux-nfs@vger.kernel.org
      cc: ceph-devel@vger.kernel.org
      cc: linux-ima-devel@lists.sourceforge.net
      146aa8b1
  19. 30 6月, 2015 1 次提交
  20. 28 6月, 2015 2 次提交
  21. 21 5月, 2015 1 次提交
    • F
      CIFS: Fix race condition on RFC1002_NEGATIVE_SESSION_RESPONSE · 4afe260b
      Federico Sauter 提交于
      This patch fixes a race condition that occurs when connecting
      to a NT 3.51 host without specifying a NetBIOS name.
      In that case a RFC1002_NEGATIVE_SESSION_RESPONSE is received
      and the SMB negotiation is reattempted, but under some conditions
      it leads SendReceive() to hang forever while waiting for srv_mutex.
      This, in turn, sets the calling process to an uninterruptible sleep
      state and makes it unkillable.
      
      The solution is to unlock the srv_mutex acquired in the demux
      thread *before* going to sleep (after the reconnect error) and
      before reattempting the connection.
      4afe260b
  22. 15 4月, 2015 1 次提交
  23. 01 4月, 2015 2 次提交
  24. 22 3月, 2015 1 次提交
  25. 21 1月, 2015 1 次提交
  26. 08 12月, 2014 1 次提交
  27. 17 10月, 2014 2 次提交
    • S
      Remap reserved posix characters by default (part 3/3) · 2baa2682
      Steve French 提交于
      This is a bigger patch, but its size is mostly due to
      a single change for how we check for remapping illegal characters
      in file names - a lot of repeated, small changes to
      the way callers request converting file names.
      
      The final patch in the series does the following:
      
      1) changes default behavior for cifs to be more intuitive.
      Currently we do not map by default to seven reserved characters,
      ie those valid in POSIX but not in NTFS/CIFS/SMB3/Windows,
      unless a mount option (mapchars) is specified.  Change this
      to by default always map and map using the SFM maping
      (like the Mac uses) unless the server negotiates the CIFS Unix
      Extensions (like Samba does when mounting with the cifs protocol)
      when the remapping of the characters is unnecessary.  This should
      help SMB3 mounts in particular since Samba will likely be
      able to implement this mapping with its new "vfs_fruit" module
      as it will be doing for the Mac.
      2) if the user specifies the existing "mapchars" mount option then
      use the "SFU" (Microsoft Services for Unix, SUA) style mapping of
      the seven characters instead.
      3) if the user specifies "nomapposix" then disable SFM/MAC style mapping
      (so no character remapping would be used unless the user specifies
      "mapchars" on mount as well, as above).
      4) change all the places in the code that check for the superblock
      flag on the mount which is set by mapchars and passed in on all
      path based operation and change it to use a small function call
      instead to set the mapping type properly (and check for the
      mapping type in the cifs unicode functions)
      Signed-off-by: NSteve French <smfrench@gmail.com>
      2baa2682
    • S
      Allow mknod and mkfifo on SMB2/SMB3 mounts · db8b631d
      Steve French 提交于
      The "sfu" mount option did not work on SMB2/SMB3 mounts.
      With these changes when the "sfu" mount option is passed in
      on an smb2/smb2.1/smb3 mount the client can emulate (and
      recognize) fifo and device (character and device files).
      
      In addition the "sfu" mount option should not conflict
      with "mfsymlinks" (symlink emulation) as we will never
      create "sfu" style symlinks, but using "sfu" mount option
      will allow us to recognize existing symlinks, created with
      Microsoft "Services for Unix" (SFU and SUA).
      
      To enable the "sfu" mount option for SMB2/SMB3 the calling
      syntax of the generic cifs/smb2/smb3 sync_read and sync_write
      protocol dependent function needed to be changed (we
      don't have a file struct in all cases), but this actually
      ended up simplifying the code a little.
      Signed-off-by: NSteve French <smfrench@gmail.com>
      db8b631d
  28. 14 10月, 2014 1 次提交
  29. 16 9月, 2014 1 次提交