1. 04 Sep, 2019 1 commit
  2. 31 Aug, 2019 3 commits
    • Christoph Hellwig's avatar
      xfs: fix the dax supported check in xfs_ioctl_setattr_dax_invalidate · adcb0ca2
      Christoph Hellwig authored
      Setting the DAX flag on the directory of a file system that is not on a
      DAX capable device makes as little sense as setting it on a regular file
      on the same file system.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
    • Dave Chinner's avatar
      xfs: allocate xattr buffer on demand · ddbca70c
      Dave Chinner authored
      When doing file lookups and checking for permissions, we end up in
      xfs_get_acl() to see if there are any ACLs on the inode. This
      requires and xattr lookup, and to do that we have to supply a buffer
      large enough to hold an maximum sized xattr.
      On workloads were we are accessing a wide range of cache cold files
      under memory pressure (e.g. NFS fileservers) we end up spending a
      lot of time allocating the buffer. The buffer is 64k in length, so
      is a contiguous multi-page allocation, and if that then fails we
      fall back to vmalloc(). Hence the allocation here is /expensive/
      when we are looking up hundreds of thousands of files a second.
      Initial numbers from a bpf trace show average time in xfs_get_acl()
      is ~32us, with ~19us of that in the memory allocation. Note these
      are average times, so there are going to be affected by the worst
      case allocations more than the common fast case...
      To avoid this, we could just do a "null"  lookup to see if the ACL
      xattr exists and then only do the allocation if it exists. This,
      however, optimises the path for the "no ACL present" case at the
      expense of the "acl present" case. i.e. we can halve the time in
      xfs_get_acl() for the no acl case (i.e down to ~10-15us), but that
      then increases the ACL case by 30% (i.e. up to 40-45us).
      To solve this and speed up both cases, drive the xattr buffer
      allocation into the attribute code once we know what the actual
      xattr length is. For the no-xattr case, we avoid the allocation
      completely, speeding up that case. For the common ACL case, we'll
      end up with a fast heap allocation (because it'll be smaller than a
      page), and only for the rarer "we have a remote xattr" will we have
      a multi-page allocation occur. Hence the common ACL case will be
      much faster, too.
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
    • Al Viro's avatar
      kill the last users of user_{path,lpath,path_dir}() · ce6595a2
      Al Viro authored
      old wrappers with few callers remaining; put them out of their misery...
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
  3. 30 Aug, 2019 1 commit
  4. 26 Aug, 2019 1 commit
  5. 07 Jul, 2019 1 commit
  6. 04 Jul, 2019 8 commits
  7. 02 Jul, 2019 3 commits
  8. 01 Jul, 2019 3 commits
  9. 29 Jun, 2019 1 commit
  10. 02 May, 2019 1 commit
  11. 23 Apr, 2019 1 commit
  12. 15 Apr, 2019 3 commits
  13. 06 Nov, 2018 1 commit
  14. 18 Oct, 2018 1 commit
  15. 06 Jun, 2018 2 commits
    • Arnd Bergmann's avatar
      xfs: fix string handling in label get/set functions · 4bb8b65a
      Arnd Bergmann authored
      [sandeen: fix subject, avoid copy-out of uninit data in getlabel]
      gcc-8 reports two warnings for the newly added getlabel/setlabel code:
      fs/xfs/xfs_ioctl.c: In function 'xfs_ioc_getlabel':
      fs/xfs/xfs_ioctl.c:1822:38: error: argument to 'sizeof' in 'strncpy' call is the same expression as the source; did you mean to use the size of the destination? [-Werror=sizeof-pointer-memaccess]
        strncpy(label, sbp->sb_fname, sizeof(sbp->sb_fname));
      In function 'strncpy',
          inlined from 'xfs_ioc_setlabel' at /git/arm-soc/fs/xfs/xfs_ioctl.c:1863:2,
          inlined from 'xfs_file_ioctl' at /git/arm-soc/fs/xfs/xfs_ioctl.c:1918:10:
      include/linux/string.h:254:9: error: '__builtin_strncpy' output may be truncated copying 12 bytes from a string of length 12 [-Werror=stringop-truncation]
        return __builtin_strncpy(p, q, size);
      In both cases, part of the problem is that one of the strncpy()
      arguments is a fixed-length character array with zero-padding rather
      than a zero-terminated string. In the first one case, we also get an
      odd warning about sizeof-pointer-memaccess, which doesn't seem right
      (the sizeof is for an array that happens to be the same as the second
      strncpy argument).
      To work around the bogus warning, I use a plain 'XFSLABEL_MAX' for
      the strncpy() length when copying the label in getlabel. For setlabel(),
      using memcpy() with the correct length that is already known avoids
      the second warning and is slightly simpler.
      In a related issue, it appears that we accidentally skip the trailing
      \0 when copying a 12-character label back to user space in getlabel().
      Using the correct sizeof() argument here copies the extra character.
      Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85602
      Fixes: f7664b31 ("xfs: implement online get/set fs label")
      Cc: Eric Sandeen <sandeen@redhat.com>
      Cc: Martin Sebor <msebor@gmail.com>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
      Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
    • Dave Chinner's avatar
      xfs: convert to SPDX license tags · 0b61f8a4
      Dave Chinner authored
      Remove the verbose license text from XFS files and replace them
      with SPDX tags. This does not change the license of any of the code,
      merely refers to the common, up-to-date license files in LICENSES/
      This change was mostly scripted. fs/xfs/Makefile and
      fs/xfs/libxfs/xfs_fs.h were modified by hand, the rest were detected
      and modified by the following command:
      for f in `git grep -l "GNU General" fs/xfs/` ; do
      	echo $f
      	cat $f | awk -f hdr.awk > $f.new
      	mv -f $f.new $f
      And the hdr.awk script that did the modification (including
      detecting the difference between GPL-2.0 and GPL-2.0+ licenses)
      is as follows:
      $ cat hdr.awk
      BEGIN {
      	hdr = 1.0
      	tag = "GPL-2.0"
      	str = ""
      /^ \* This program is free software/ {
      	hdr = 2.0;
      /any later version./ {
      	tag = "GPL-2.0+"
      /^ \*\// {
      	if (hdr > 0.0) {
      		print "// SPDX-License-Identifier: " tag
      		print str
      		print $0
      		hdr = 0.0
      	print $0
      /^ \* / {
      	if (hdr > 1.0)
      	if (hdr > 0.0) {
      		if (str != "")
      			str = str "\n"
      		str = str $0
      	print $0
      /^ \*/ {
      	if (hdr > 0.0)
      	print $0
      // {
      	if (hdr > 0.0) {
      		if (str != "")
      			str = str "\n"
      		str = str $0
      	print $0
      END { }
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
  16. 04 Jun, 2018 1 commit
  17. 31 May, 2018 2 commits
  18. 22 May, 2018 2 commits
    • Dan Williams's avatar
      xfs: prepare xfs_break_layouts() for another layout type · 69eb5fa1
      Dan Williams authored
      When xfs is operating as the back-end of a pNFS block server, it
      prevents collisions between local and remote operations by requiring a
      lease to be held for remotely accessed blocks. Local filesystem
      operations break those leases before writing or mutating the extent map
      of the file.
      A similar mechanism is needed to prevent operations on pinned dax
      mappings, like device-DMA, from colliding with extent unmap operations.
      BREAK_WRITE and BREAK_UNMAP are introduced as two distinct levels of
      layout breaking.
      Layouts are broken in the BREAK_WRITE case to ensure that layout-holders
      do not collide with local writes. Additionally, layouts are broken in
      the BREAK_UNMAP case to make sure the layout-holder has a consistent
      view of the file's extent map. While BREAK_WRITE breaks can be satisfied
      be recalling FL_LAYOUT leases, BREAK_UNMAP breaks additionally require
      waiting for busy dax-pages to go idle while holding XFS_MMAPLOCK_EXCL.
      After this refactoring xfs_break_layouts() becomes the entry point for
      coordinating both types of breaks. Finally, xfs_break_leased_layouts()
      becomes just the BREAK_WRITE handler.
      Note that the unlock tracking is needed in a follow on change. That will
      coordinate retrying either break handler until both successfully test
      for a lease break while maintaining the lock state.
      Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
      Cc: "Darrick J. Wong" <darrick.wong@oracle.com>
      Reported-by: default avatarDave Chinner <david@fromorbit.com>
      Reported-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
    • Dan Williams's avatar
      xfs: prepare xfs_break_layouts() to be called with XFS_MMAPLOCK_EXCL · c63a8eae
      Dan Williams authored
      In preparation for adding coordination between extent unmap operations
      and busy dax-pages, update xfs_break_layouts() to permit it to be called
      with the mmap lock held. This lock scheme will be required for
      coordinating the break of 'dax layouts' (non-idle dax (ZONE_DEVICE)
      pages mapped into the file's address space). Breaking dax layouts will
      be added to xfs_break_layouts() in a future patch, for now this preps
      the unmap call sites to take and hold XFS_MMAPLOCK_EXCL over the call to
      Cc: "Darrick J. Wong" <darrick.wong@oracle.com>
      Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
      Cc: Dave Chinner <david@fromorbit.com>
      Suggested-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatar"Darrick J. Wong" <darrick.wong@oracle.com>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
  19. 16 May, 2018 1 commit
    • Eric Sandeen's avatar
      xfs: implement online get/set fs label · f7664b31
      Eric Sandeen authored
      The GET ioctl is trivial, just return the current label.
      The SET ioctl is more involved:
      It transactionally modifies the superblock to write a new filesystem
      label to the primary super.
      A new variant of xfs_sync_sb then writes the superblock buffer
      immediately to disk so that the change is visible from userspace.
      It then invalidates any page cache that userspace might have previously
      read on the block device so that i.e. blkid can see the change
      immediately, and updates all secondary superblocks as userspace relable
      Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
      [darrick: use dchinner's new xfs_update_secondary_sbs function]
      Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
  20. 08 Jan, 2018 2 commits
  21. 09 Nov, 2017 1 commit