1. 26 4月, 2021 6 次提交
    • R
      cifs: check the timestamp for the cached dirent when deciding on revalidate · f6d2353a
      Ronnie Sahlberg 提交于
      Improves directory metadata caching
      Signed-off-by: NRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      f6d2353a
    • R
      cifs: pass the dentry instead of the inode down to the revalidation check functions · ed8561fa
      Ronnie Sahlberg 提交于
      Needed for the final patch in the directory caching series
      Signed-off-by: NRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      ed8561fa
    • A
      cifs: allocate buffer in the caller of build_path_from_dentry() · f6a9bc33
      Al Viro 提交于
      build_path_from_dentry() open-codes dentry_path_raw().  The reason
      we can't use dentry_path_raw() in there (and postprocess the
      result as needed) is that the callers of build_path_from_dentry()
      expect that the object to be freed on cleanup and the string to
      be used are at the same address.  That's painful, since the path
      is naturally built end-to-beginning - we start at the leaf and
      go through the ancestors, accumulating the pathname.
      
      Life would be easier if we left the buffer allocation to callers.
      It wouldn't be exact-sized buffer, but none of the callers keep
      the result for long - it's always freed before the caller returns.
      So there's no need to do exact-sized allocation; better use
      __getname()/__putname(), same as we do for pathname arguments
      of syscalls.  What's more, there's no need to do allocation under
      spinlocks, so GFP_ATOMIC is not needed.
      
      Next patch will replace the open-coded dentry_path_raw() (in
      build_path_from_dentry_optional_prefix()) with calling the real
      thing.  This patch only introduces wrappers for allocating/freeing
      the buffers and switches to new calling conventions:
      	build_path_from_dentry(dentry, buf)
      expects buf to be address of a page-sized object or NULL,
      return value is a pathname built inside that buffer on success,
      ERR_PTR(-ENOMEM) if buf is NULL and ERR_PTR(-ENAMETOOLONG) if
      the pathname won't fit into page.  Note that we don't need to
      check for failure when allocating the buffer in the caller -
      build_path_from_dentry() will do the right thing.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      f6a9bc33
    • A
      cifs: make build_path_from_dentry() return const char * · 8e33cf20
      Al Viro 提交于
      ... and adjust the callers.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      8e33cf20
    • A
      f6f1f179
    • A
      cifs: remove old dead code · ec4e4862
      Aurelien Aptel 提交于
      While reviewing a patch clarifying locks and locking hierarchy I
      realized some locks were unused.
      
      This commit removes old data and code that isn't actually used
      anywhere, or hidden in ifdefs which cannot be enabled from the kernel
      config.
      
      * The uid/gid trees and associated locks are left-overs from when
        uid/sid mapping had an extra caching layer on top of the keyring and
        are now unused.
        See commit faa65f07 ("cifs: simplify id_to_sid and sid_to_id mapping code")
        from 2012.
      
      * cifs_oplock_break_ops is a left-over from when slow_work was remplaced
        by regular workqueue and is now unused.
        See commit 9b646972 ("cifs: use workqueue instead of slow-work")
        from 2010.
      
      * CIFSSMBSetAttrLegacy is SMB1 cruft dealing with some legacy
        NT4/Win9x behaviour.
      
      * Remove CONFIG_CIFS_DNOTIFY_EXPERIMENTAL left-overs. This was already
        partially removed in 392e1c5d ("cifs: rename and clarify CIFS_ASYNC_OP and CIFS_NO_RESP")
        from 2019. Kill it completely.
      
      * Another candidate that was considered but spared is
        CONFIG_CIFS_NFSD_EXPORT which has an empty implementation and cannot
        be enabled by a config option (although it is listed but disabled with
        "BROKEN" as a dep). It's unclear whether this could even function
        today in its current form but it has it's own .c file and Kconfig
        entry which is a bit more involved to remove and might make a come
        back?
      Signed-off-by: NAurelien Aptel <aaptel@suse.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      ec4e4862
  2. 20 3月, 2021 1 次提交
    • S
      cifs: fix allocation size on newly created files · 65af8f01
      Steve French 提交于
      Applications that create and extend and write to a file do not
      expect to see 0 allocation size.  When file is extended,
      set its allocation size to a plausible value until we have a
      chance to query the server for it.  When the file is cached
      this will prevent showing an impossible number of allocated
      blocks (like 0).  This fixes e.g. xfstests 614 which does
      
          1) create a file and set its size to 64K
          2) mmap write 64K to the file
          3) stat -c %b for the file (to query the number of allocated blocks)
      
      It was failing because we returned 0 blocks.  Even though we would
      return the correct cached file size, we returned an impossible
      allocation size.
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      CC: <stable@vger.kernel.org>
      Reviewed-by: NAurelien Aptel <aaptel@suse.com>
      65af8f01
  3. 26 2月, 2021 2 次提交
  4. 24 1月, 2021 3 次提交
  5. 14 12月, 2020 6 次提交
  6. 24 10月, 2020 1 次提交
    • S
      smb3: add support for stat of WSL reparse points for special file types · 2e4564b3
      Steve French 提交于
      This is needed so when mounting to Windows we do not
      misinterpret various special files created by Linux (WSL) as symlinks.
      An earlier patch addressed readdir.  This patch fixes stat (getattr).
      
      With this patch:
        File: /mnt1/char
        Size: 0          Blocks: 0          IO Block: 16384  character special file
      Device: 34h/52d Inode: 844424930132069  Links: 1     Device type: 0,0
      Access: (0755/crwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
      Access: 2020-10-21 17:46:51.839458900 -0500
      Modify: 2020-10-21 17:46:51.839458900 -0500
      Change: 2020-10-21 18:30:39.797358800 -0500
       Birth: -
        File: /mnt1/fifo
        Size: 0          Blocks: 0          IO Block: 16384  fifo
      Device: 34h/52d Inode: 1125899906842722  Links: 1
      Access: (0755/prwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
      Access: 2020-10-21 16:21:37.259249700 -0500
      Modify: 2020-10-21 16:21:37.259249700 -0500
      Change: 2020-10-21 18:30:39.797358800 -0500
       Birth: -
        File: /mnt1/block
        Size: 0          Blocks: 0          IO Block: 16384  block special file
      Device: 34h/52d Inode: 844424930132068  Links: 1     Device type: 0,0
      Access: (0755/brwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
      Access: 2020-10-21 17:10:47.913103200 -0500
      Modify: 2020-10-21 17:10:47.913103200 -0500
      Change: 2020-10-21 18:30:39.796725500 -0500
       Birth: -
      
      without the patch all show up incorrectly as symlinks with annoying "operation not supported error also returned"
        File: /mnt1/charstat: cannot read symbolic link '/mnt1/char': Operation not supported
      
        Size: 0          Blocks: 0          IO Block: 16384  symbolic link
      Device: 34h/52d Inode: 844424930132069  Links: 1
      Access: (0000/l---------)  Uid: (    0/    root)   Gid: (    0/    root)
      Access: 2020-10-21 17:46:51.839458900 -0500
      Modify: 2020-10-21 17:46:51.839458900 -0500
      Change: 2020-10-21 18:30:39.797358800 -0500
       Birth: -
        File: /mnt1/fifostat: cannot read symbolic link '/mnt1/fifo': Operation not supported
      
        Size: 0          Blocks: 0          IO Block: 16384  symbolic link
      Device: 34h/52d Inode: 1125899906842722  Links: 1
      Access: (0000/l---------)  Uid: (    0/    root)   Gid: (    0/    root)
      Access: 2020-10-21 16:21:37.259249700 -0500
      Modify: 2020-10-21 16:21:37.259249700 -0500
      Change: 2020-10-21 18:30:39.797358800 -0500
       Birth: -
        File: /mnt1/blockstat: cannot read symbolic link '/mnt1/block': Operation not supported
      
        Size: 0          Blocks: 0          IO Block: 16384  symbolic link
      Device: 34h/52d Inode: 844424930132068  Links: 1
      Access: (0000/l---------)  Uid: (    0/    root)   Gid: (    0/    root)
      Access: 2020-10-21 17:10:47.913103200 -0500
      Modify: 2020-10-21 17:10:47.913103200 -0500
      Change: 2020-10-21 18:30:39.796725500 -0500
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Reviewed-by: NRonnie Sahlberg <lsahlber@redhat.com>
      2e4564b3
  7. 16 10月, 2020 1 次提交
    • R
      cifs: handle -EINTR in cifs_setattr · c6cc4c5a
      Ronnie Sahlberg 提交于
      RHBZ: 1848178
      
      Some calls that set attributes, like utimensat(), are not supposed to return
      -EINTR and thus do not have handlers for this in glibc which causes us
      to leak -EINTR to the applications which are also unprepared to handle it.
      
      For example tar will break if utimensat() return -EINTR and abort unpacking
      the archive. Other applications may break too.
      
      To handle this we add checks, and retry, for -EINTR in cifs_setattr()
      Signed-off-by: NRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      c6cc4c5a
  8. 07 9月, 2020 1 次提交
  9. 03 8月, 2020 1 次提交
  10. 24 7月, 2020 1 次提交
  11. 02 7月, 2020 1 次提交
  12. 24 6月, 2020 1 次提交
  13. 13 6月, 2020 1 次提交
  14. 12 6月, 2020 2 次提交
  15. 05 6月, 2020 1 次提交
  16. 04 6月, 2020 1 次提交
  17. 01 6月, 2020 2 次提交
    • J
      cifs: Standardize logging output · a0a3036b
      Joe Perches 提交于
      Use pr_fmt to standardize all logging for fs/cifs.
      
      Some logging output had no CIFS: specific prefix.
      
      Now all output has one of three prefixes:
      
      o CIFS:
      o CIFS: VFS:
      o Root-CIFS:
      
      Miscellanea:
      
      o Convert printks to pr_<level>
      o Neaten macro definitions
      o Remove embedded CIFS: prefixes from formats
      o Convert "illegal" to "invalid"
      o Coalesce formats
      o Add missing '\n' format terminations
      o Consolidate multiple cifs_dbg continuations into single calls
      o More consistent use of upper case first word output logging
      o Multiline statement argument alignment and wrapping
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      a0a3036b
    • S
      smb3: Add new parm "nodelete" · 82e9367c
      Steve French 提交于
      In order to handle workloads where it is important to make sure that
      a buggy app did not delete content on the drive, the new mount option
      "nodelete" allows standard permission checks on the server to work,
      but prevents on the client any attempts to unlink a file or delete
      a directory on that mount point.  This can be helpful when running
      a little understood app on a network mount that contains important
      content that should not be deleted.
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      CC: Stable <stable@vger.kernel.org>
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      82e9367c
  18. 06 5月, 2020 1 次提交
  19. 16 4月, 2020 1 次提交
    • J
      cifs: improve read performance for page size 64KB & cache=strict & vers=2.1+ · 1f641d94
      Jones Syue 提交于
      Found a read performance issue when linux kernel page size is 64KB.
      If linux kernel page size is 64KB and mount options cache=strict &
      vers=2.1+, it does not support cifs_readpages(). Instead, it is using
      cifs_readpage() and cifs_read() with maximum read IO size 16KB, which is
      much slower than read IO size 1MB when negotiated SMB 2.1+. Since modern
      SMB server supported SMB 2.1+ and Max Read Size can reach more than 64KB
      (for example 1MB ~ 8MB), this patch check max_read instead of maxBuf to
      determine whether server support readpages() and improve read performance
      for page size 64KB & cache=strict & vers=2.1+, and for SMB1 it is more
      cleaner to initialize server->max_read to server->maxBuf.
      
      The client is a linux box with linux kernel 4.2.8,
      page size 64KB (CONFIG_ARM64_64K_PAGES=y),
      cpu arm 1.7GHz, and use mount.cifs as smb client.
      The server is another linux box with linux kernel 4.2.8,
      share a file '10G.img' with size 10GB,
      and use samba-4.7.12 as smb server.
      
      The client mount a share from the server with different
      cache options: cache=strict and cache=none,
      mount -tcifs //<server_ip>/Public /cache_strict -overs=3.0,cache=strict,username=<xxx>,password=<yyy>
      mount -tcifs //<server_ip>/Public /cache_none -overs=3.0,cache=none,username=<xxx>,password=<yyy>
      
      The client download a 10GbE file from the server across 1GbE network,
      dd if=/cache_strict/10G.img of=/dev/null bs=1M count=10240
      dd if=/cache_none/10G.img of=/dev/null bs=1M count=10240
      
      Found that cache=strict (without patch) is slower read throughput and
      smaller read IO size than cache=none.
      cache=strict (without patch): read throughput 40MB/s, read IO size is 16KB
      cache=strict (with patch): read throughput 113MB/s, read IO size is 1MB
      cache=none: read throughput 109MB/s, read IO size is 1MB
      
      Looks like if page size is 64KB,
      cifs_set_ops() would use cifs_addr_ops_smallbuf instead of cifs_addr_ops,
      
      	/* check if server can support readpages */
      	if (cifs_sb_master_tcon(cifs_sb)->ses->server->maxBuf <
      			PAGE_SIZE + MAX_CIFS_HDR_SIZE)
      		inode->i_data.a_ops = &cifs_addr_ops_smallbuf;
      	else
      		inode->i_data.a_ops = &cifs_addr_ops;
      
      maxBuf is came from 2 places, SMB2_negotiate() and CIFSSMBNegotiate(),
      (SMB2_MAX_BUFFER_SIZE is 64KB)
      SMB2_negotiate():
      	/* set it to the maximum buffer size value we can send with 1 credit */
      	server->maxBuf = min_t(unsigned int, le32_to_cpu(rsp->MaxTransactSize),
      			       SMB2_MAX_BUFFER_SIZE);
      CIFSSMBNegotiate():
      	server->maxBuf = le32_to_cpu(pSMBr->MaxBufferSize);
      
      Page size 64KB and cache=strict lead to read_pages() use cifs_readpage()
      instead of cifs_readpages(), and then cifs_read() using maximum read IO
      size 16KB, which is much slower than maximum read IO size 1MB.
      (CIFSMaxBufSize is 16KB by default)
      
      	/* FIXME: set up handlers for larger reads and/or convert to async */
      	rsize = min_t(unsigned int, cifs_sb->rsize, CIFSMaxBufSize);
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      Signed-off-by: NJones Syue <jonessyue@qnap.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      1f641d94
  20. 11 4月, 2020 1 次提交
    • S
      smb3: enable swap on SMB3 mounts · 4e8aea30
      Steve French 提交于
      Add experimental support for allowing a swap file to be on an SMB3
      mount.  There are use cases where swapping over a secure network
      filesystem is preferable. In some cases there are no local
      block devices large enough, and network block devices can be
      hard to setup and secure.  And in some cases there are no
      local block devices at all (e.g. with the recent addition of
      remote boot over SMB3 mounts).
      
      There are various enhancements that can be added later e.g.:
      - doing a mandatory byte range lock over the swapfile (until
      the Linux VFS is modified to notify the file system that an open
      is for a swapfile, when the file can be opened "DENY_ALL" to prevent
      others from opening it).
      - pinning more buffers in the underlying transport to minimize memory
      allocations in the TCP stack under the fs
      - documenting how to create ACLs (on the server) to secure the
      swapfile (or adding additional tools to cifs-utils to make it easier)
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Acked-by: NPavel Shilovsky <pshilov@microsoft.com>
      Reviewed-by: NRonnie Sahlberg <lsahlber@redhat.com>
      4e8aea30
  21. 23 3月, 2020 3 次提交
  22. 18 3月, 2020 1 次提交
  23. 25 2月, 2020 1 次提交