1. 26 4月, 2018 1 次提交
  2. 13 4月, 2018 2 次提交
  3. 12 4月, 2018 1 次提交
  4. 03 4月, 2018 1 次提交
  5. 07 2月, 2018 1 次提交
  6. 27 1月, 2018 1 次提交
    • A
      CIFS: make IPC a regular tcon · b327a717
      Aurelien Aptel 提交于
      * Remove ses->ipc_tid.
      * Make IPC$ regular tcon.
      * Add a direct pointer to it in ses->tcon_ipc.
      * Distinguish PIPE tcon from IPC tcon by adding a tcon->pipe flag. All
        IPC tcons are pipes but not all pipes are IPC.
      * All TreeConnect functions now cannot take a NULL tcon object.
      
      The IPC tcon has the same lifetime as the session it belongs to. It is
      created when the session is created and destroyed when the session is
      destroyed.
      
      Since no mounts directly refer to the IPC tcon, its refcount should
      always be set to initialisation value (1). Thus we make sure
      cifs_put_tcon() skips it.
      
      If the mount request resulting in a new session being created requires
      encryption, try to require it too for IPC.
      
      * set SERVER_NAME_LENGTH to serverName actual size
      
      The maximum length of an ipv6 string representation is defined in
      INET6_ADDRSTRLEN as 45+1 for null but lets keep what we know works.
      Signed-off-by: NAurelien Aptel <aaptel@suse.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      b327a717
  7. 25 1月, 2018 2 次提交
  8. 05 9月, 2017 2 次提交
    • S
      cifs: Check for timeout on Negotiate stage · 76e75270
      Samuel Cabrero 提交于
      Some servers seem to accept connections while booting but never send
      the SMBNegotiate response neither close the connection, causing all
      processes accessing the share hang on uninterruptible sleep state.
      
      This happens when the cifs_demultiplex_thread detects the server is
      unresponsive so releases the socket and start trying to reconnect.
      At some point, the faulty server will accept the socket and the TCP
      status will be set to NeedNegotiate. The first issued command accessing
      the share will start the negotiation (pid 5828 below), but the response
      will never arrive so other commands will be blocked waiting on the mutex
      (pid 55352).
      
      This patch checks for unresponsive servers also on the negotiate stage
      releasing the socket and reconnecting if the response is not received
      and checking again the tcp state when the mutex is acquired.
      
      PID: 55352  TASK: ffff880fd6cc02c0  CPU: 0   COMMAND: "ls"
       #0 [ffff880fd9add9f0] schedule at ffffffff81467eb9
       #1 [ffff880fd9addb38] __mutex_lock_slowpath at ffffffff81468fe0
       #2 [ffff880fd9addba8] mutex_lock at ffffffff81468b1a
       #3 [ffff880fd9addbc0] cifs_reconnect_tcon at ffffffffa042f905 [cifs]
       #4 [ffff880fd9addc60] smb_init at ffffffffa042faeb [cifs]
       #5 [ffff880fd9addca0] CIFSSMBQPathInfo at ffffffffa04360b5 [cifs]
       ....
      
      Which is waiting a mutex owned by:
      
      PID: 5828   TASK: ffff880fcc55e400  CPU: 0   COMMAND: "xxxx"
       #0 [ffff880fbfdc19b8] schedule at ffffffff81467eb9
       #1 [ffff880fbfdc1b00] wait_for_response at ffffffffa044f96d [cifs]
       #2 [ffff880fbfdc1b60] SendReceive at ffffffffa04505ce [cifs]
       #3 [ffff880fbfdc1bb0] CIFSSMBNegotiate at ffffffffa0438d79 [cifs]
       #4 [ffff880fbfdc1c50] cifs_negotiate_protocol at ffffffffa043b383 [cifs]
       #5 [ffff880fbfdc1c80] cifs_reconnect_tcon at ffffffffa042f911 [cifs]
       #6 [ffff880fbfdc1d20] smb_init at ffffffffa042faeb [cifs]
       #7 [ffff880fbfdc1d60] CIFSSMBQFSInfo at ffffffffa0434eb0 [cifs]
       ....
      Signed-off-by: NSamuel Cabrero <scabrero@suse.de>
      Reviewed-by: NAurélien Aptel <aaptel@suse.de>
      Reviewed-by: NRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      76e75270
    • R
      cifs: Add support for writing attributes on SMB2+ · 5517554e
      Ronnie Sahlberg 提交于
      This adds support for writing extended attributes on SMB2+ shares.
      Attributes can be written using the setfattr command.
      
      RH-bz: 1110709
      Signed-off-by: NRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      5517554e
  9. 16 7月, 2017 1 次提交
    • B
      fs/locks: Remove fl_nspid and use fs-specific l_pid for remote locks · 9d5b86ac
      Benjamin Coddington 提交于
      Since commit c69899a1 "NFSv4: Update of VFS byte range lock must be
      atomic with the stateid update", NFSv4 has been inserting locks in rpciod
      worker context.  The result is that the file_lock's fl_nspid is the
      kworker's pid instead of the original userspace pid.
      
      The fl_nspid is only used to represent the namespaced virtual pid number
      when displaying locks or returning from F_GETLK.  There's no reason to set
      it for every inserted lock, since we can usually just look it up from
      fl_pid.  So, instead of looking up and holding struct pid for every lock,
      let's just look up the virtual pid number from fl_pid when it is needed.
      That means we can remove fl_nspid entirely.
      
      The translaton and presentation of fl_pid should handle the following four
      cases:
      
      1 - F_GETLK on a remote file with a remote lock:
          In this case, the filesystem should determine the l_pid to return here.
          Filesystems should indicate that the fl_pid represents a non-local pid
          value that should not be translated by returning an fl_pid <= 0.
      
      2 - F_GETLK on a local file with a remote lock:
          This should be the l_pid of the lock manager process, and translated.
      
      3 - F_GETLK on a remote file with a local lock, and
      4 - F_GETLK on a local file with a local lock:
          These should be the translated l_pid of the local locking process.
      
      Fuse was already doing the correct thing by translating the pid into the
      caller's namespace.  With this change we must update fuse to translate
      to init's pid namespace, so that the locks API can then translate from
      init's pid namespace into the pid namespace of the caller.
      
      With this change, the locks API will expect that if a filesystem returns
      a remote pid as opposed to a local pid for F_GETLK, that remote pid will
      be <= 0.  This signifies that the pid is remote, and the locks API will
      forego translating that pid into the pid namespace of the local calling
      process.
      
      Finally, we convert remote filesystems to present remote pids using
      negative numbers. Have lustre, 9p, ceph, cifs, and dlm negate the remote
      pid returned for F_GETLK lock requests.
      
      Since local pids will never be larger than PID_MAX_LIMIT (which is
      currently defined as <= 4 million), but pid_t is an unsigned int, we
      should have plenty of room to represent remote pids with negative
      numbers if we assume that remote pid numbers are similarly limited.
      
      If this is not the case, then we run the risk of having a remote pid
      returned for which there is also a corresponding local pid.  This is a
      problem we have now, but this patch should reduce the chances of that
      occurring, while also returning those remote pid numbers, for whatever
      that may be worth.
      Signed-off-by: NBenjamin Coddington <bcodding@redhat.com>
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      9d5b86ac
  10. 09 7月, 2017 1 次提交
    • P
      CIFS: Reconnect expired SMB sessions · 511c54a2
      Pavel Shilovsky 提交于
      According to the MS-SMB2 spec (3.2.5.1.6) once the client receives
      STATUS_NETWORK_SESSION_EXPIRED error code from a server it should
      reconnect the current SMB session. Currently the client doesn't do
      that. This can result in subsequent client requests failing by
      the server. The patch adds an additional logic to the demultiplex
      thread to identify expired sessions and reconnect them.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NPavel Shilovsky <pshilov@microsoft.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      511c54a2
  11. 13 5月, 2017 1 次提交
  12. 10 5月, 2017 1 次提交
    • S
      Don't delay freeing mids when blocked on slow socket write of request · de1892b8
      Steve French 提交于
      When processing responses, and in particular freeing mids (DeleteMidQEntry),
      which is very important since it also frees the associated buffers (cifs_buf_release),
      we can block a long time if (writes to) socket is slow due to low memory or networking
      issues.
      
      We can block in send (smb request) waiting for memory, and be blocked in processing
      responess (which could free memory if we let it) - since they both grab the
      server->srv_mutex.
      
      In practice, in the DeleteMidQEntry case - there is no reason we need to
      grab the srv_mutex so remove these around DeleteMidQEntry, and it allows
      us to free memory faster.
      Signed-off-by: NSteve French <steve.french@primarydata.com>
      Acked-by: NPavel Shilovsky <pshilov@microsoft.com>
      de1892b8
  13. 09 5月, 2017 1 次提交
  14. 03 5月, 2017 1 次提交
  15. 11 4月, 2017 1 次提交
  16. 07 4月, 2017 1 次提交
    • S
      Handle mismatched open calls · 38bd4906
      Sachin Prabhu 提交于
      A signal can interrupt a SendReceive call which result in incoming
      responses to the call being ignored. This is a problem for calls such as
      open which results in the successful response being ignored. This
      results in an open file resource on the server.
      
      The patch looks into responses which were cancelled after being sent and
      in case of successful open closes the open fids.
      
      For this patch, the check is only done in SendReceive2()
      
      RH-bz: 1403319
      Signed-off-by: NSachin Prabhu <sprabhu@redhat.com>
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      Cc: Stable <stable@vger.kernel.org>
      38bd4906
  17. 03 3月, 2017 1 次提交
  18. 02 3月, 2017 1 次提交
  19. 02 2月, 2017 4 次提交
  20. 25 12月, 2016 1 次提交
  21. 29 11月, 2016 1 次提交
    • E
      CIFS: iterate over posix acl xattr entry correctly in ACL_to_cifs_posix() · ae9ebe7c
      Eryu Guan 提交于
      Commit 2211d5ba ("posix_acl: xattr representation cleanups")
      removes the typedefs and the zero-length a_entries array in struct
      posix_acl_xattr_header, and uses bare struct posix_acl_xattr_header
      and struct posix_acl_xattr_entry directly.
      
      But it failed to iterate over posix acl slots when converting posix
      acls to CIFS format, which results in several test failures in
      xfstests (generic/053 generic/105) when testing against a samba v1
      server, starting from v4.9-rc1 kernel. e.g.
      
        [root@localhost xfstests]# diff -u tests/generic/105.out /root/xfstests/results//generic/105.out.bad
        --- tests/generic/105.out       2016-09-19 16:33:28.577962575 +0800
        +++ /root/xfstests/results//generic/105.out.bad 2016-10-22 15:41:15.201931110 +0800
        @@ -1,3 +1,4 @@
         QA output created by 105
         -rw-r--r-- root
        +setfacl: subdir: Invalid argument
         -rw-r--r-- root
      
      Fix it by introducing a new "ace" var, like what
      cifs_copy_posix_acl() does, and iterating posix acl xattr entries
      over it in the for loop.
      Signed-off-by: NEryu Guan <guaneryu@gmail.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      ae9ebe7c
  22. 13 10月, 2016 1 次提交
  23. 28 9月, 2016 2 次提交
  24. 24 4月, 2016 1 次提交
  25. 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
  26. 29 3月, 2016 1 次提交
  27. 29 2月, 2016 1 次提交
  28. 20 8月, 2015 1 次提交
    • C
      cifs: Fix use-after-free on mid_q_entry · 5fb4e288
      Christopher Oo 提交于
      With CIFS_DEBUG_2 enabled, additional debug information is tracked inside each
      mid_q_entry struct, however cifs_save_when_sent may use the mid_q_entry after it
      has been freed from the appropriate callback if the transport layer has very low
      latency. Holding the srv_mutex fixes this use-after-free, as cifs_save_when_sent
      is called while the srv_mutex is held while the request is sent.
      Signed-off-by: NChristopher Oo <t-chriso@microsoft.com>
      5fb4e288
  29. 28 6月, 2015 1 次提交
  30. 21 5月, 2015 1 次提交
    • D
      CIFS: remove an unneeded NULL check · 65c3b205
      Dan Carpenter 提交于
      Smatch complains because we dereference "ses->server" without checking
      some lines earlier inside the call to get_next_mid(ses->server).
      
      	fs/cifs/cifssmb.c:4921 CIFSGetDFSRefer()
      	warn: variable dereferenced before check 'ses->server' (see line 4899)
      
      There is only one caller for this function get_dfs_path() and it always
      passes a non-null "ses->server" pointer so this NULL check can be
      removed.
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      65c3b205
  31. 11 5月, 2015 1 次提交
  32. 16 4月, 2015 1 次提交
  33. 11 12月, 2014 1 次提交