1. 07 May, 2020 2 commits
  2. 12 Mar, 2020 1 commit
  3. 26 Jan, 2020 6 commits
  4. 28 Oct, 2019 1 commit
  5. 27 Aug, 2019 1 commit
  6. 29 Jun, 2019 6 commits
  7. 12 Jun, 2019 2 commits
  8. 18 Feb, 2019 1 commit
  9. 12 Feb, 2019 2 commits
    • Brian Foster's avatar
      xfs: distinguish between inobt and finobt magic values · 8473fee3
      Brian Foster authored
      
      The inode btree verifier code is shared between the inode btree and
      free inode btree because the underlying metadata formats are
      essentially equivalent. A side effect of this is that the verifier
      cannot determine whether a particular btree block should have an
      inobt or finobt magic value.
      
      This logic allows an unfortunate xfs_repair bug to escape detection
      where certain level > 0 nodes of the finobt are stamped with inobt
      magic by xfs_repair finobt reconstruction. This is fortunately not a
      severe problem since the inode btree magic values do not contribute
      to any changes in kernel behavior, but we do need a means to detect
      and prevent this problem in the future.
      
      Add a field to xfs_buf_ops to store the v4 and v5 superblock magic
      values expected by a particular verifier. Add a helper to check an
      on-disk magic value against the value expected by the verifier. Call
      the helper from the shared [f]inobt verifier code for magic value
      verification. This ensures that the inode btree blocks each have the
      appropriate magic value based on specific tree type and superblock
      version.
      Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
      Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      8473fee3
    • Brian Foster's avatar
      xfs: clarify documentation for the function to reverify buffers · 75d02303
      Brian Foster authored
      
      Improve the documentation around xfs_buf_ensure_ops, which is the
      function that is responsible for cleaning up the b_ops state of buffers
      that go through xrep_findroot_block but don't match anything.  Rename
      the function to xfs_buf_reverify.
      
      [darrick: this started off as bfoster mods of a previous patch of mine,
      but the renaming part is now this separate patch.]
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
      75d02303
  10. 18 Oct, 2018 1 commit
  11. 12 Aug, 2018 1 commit
  12. 12 Jul, 2018 2 commits
  13. 06 Jun, 2018 1 commit
    • 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
      done
      
      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;
      	next
      }
      
      /any later version./ {
      	tag = "GPL-2.0+"
      	next
      }
      
      /^ \*\// {
      	if (hdr > 0.0) {
      		print "// SPDX-License-Identifier: " tag
      		print str
      		print $0
      		str=""
      		hdr = 0.0
      		next
      	}
      	print $0
      	next
      }
      
      /^ \* / {
      	if (hdr > 1.0)
      		next
      	if (hdr > 0.0) {
      		if (str != "")
      			str = str "\n"
      		str = str $0
      		next
      	}
      	print $0
      	next
      }
      
      /^ \*/ {
      	if (hdr > 0.0)
      		next
      	print $0
      	next
      }
      
      // {
      	if (hdr > 0.0) {
      		if (str != "")
      			str = str "\n"
      		str = str $0
      		next
      	}
      	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>
      0b61f8a4
  14. 16 May, 2018 1 commit
    • Dave Chinner's avatar
      xfs: one-shot cached buffers · 879de98e
      Dave Chinner authored
      
      For the new growfs work, we want to ensure that we serialise
      secondary superblock updates with other operations (e.g. scrub)
      correctly, but we don't want to cache the buffers for long term
      reuse. We need cached buffers for serialisation, however.
      
      To solve this, introduce a "oneshot" buffer which will be marshalled
      through the cache but then released once the last current reference
      goes away. If the buffer is already cached, then we ignore the
      "one-shot" behaviour and leave the buffer in the state it was prior
      to the one-shot command being run. This means we don't perturb
      either the working set or existing cached buffer state by a one-shot
      operation.
      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>
      879de98e
  15. 09 May, 2018 1 commit
  16. 09 Apr, 2018 1 commit
  17. 29 Jan, 2018 2 commits
  18. 08 Jan, 2018 2 commits
  19. 26 Oct, 2017 1 commit
    • Brian Foster's avatar
      xfs: buffer lru reference count error injection tag · 7561d27e
      Brian Foster authored
      
      XFS uses a fixed reference count for certain types of buffers in the
      internal LRU cache. These reference counts dictate how aggressively
      certain buffers are reclaimed vs. others. While the reference counts
      implements priority across different buffer types, all buffers
      (other than uncached buffers) are typically cached for at least one
      reclaim cycle.
      
      We've had at least one bug recently that has been hidden by a
      released buffer sitting around in the LRU. Users hitting the problem
      were able to reproduce under enough memory pressure to cause
      aggressive reclaim in a particular window of time.
      
      To support future xfstests cases, add an error injection tag to
      hardcode the buffer reference count to zero. When enabled, this
      bypasses caching of associated buffers and facilitates test cases
      that depend on this behavior.
      Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
      Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      7561d27e
  20. 31 Aug, 2017 1 commit
  21. 19 Jun, 2017 1 commit
    • Brian Foster's avatar
      xfs: push buffer of flush locked dquot to avoid quotacheck deadlock · 7912e7fe
      Brian Foster authored
      Reclaim during quotacheck can lead to deadlocks on the dquot flush
      lock:
      
       - Quotacheck populates a local delwri queue with the physical dquot
         buffers.
       - Quotacheck performs the xfs_qm_dqusage_adjust() bulkstat and
         dirties all of the dquots.
       - Reclaim kicks in and attempts to flush a dquot whose buffer is
         already queud on the quotacheck queue. The flush succeeds but
         queueing to the reclaim delwri queue fails as the backing buffer is
         already queued. The flush unlock is now deferred to I/O completion
         of the buffer from the quotacheck queue.
       - The dqadjust bulkstat continues and dirties the recently flushed
         dquot once again.
       - Quotacheck proceeds to the xfs_qm_flush_one() walk which requires
         the flush lock to update the backing buffers with the in-core
         recalculated values. It deadlocks on the redirtied dquot as the
         flush lock was already acquired by reclaim, but the buffer resides
         on the local delwri queue which isn't submitted until the end of
         quotacheck.
      
      This is reproduced by running quotacheck on a filesystem with a
      couple million inodes in low memory (512MB-1GB) situations. This is
      a regression as of commit 43ff2122
      
       ("xfs: on-stack delayed write
      buffer lists"), which removed a trylock and buffer I/O submission
      from the quotacheck dquot flush sequence.
      
      Quotacheck first resets and collects the physical dquot buffers in a
      delwri queue. Then, it traverses the filesystem inodes via bulkstat,
      updates the in-core dquots, flushes the corrected dquots to the
      backing buffers and finally submits the delwri queue for I/O. Since
      the backing buffers are queued across the entire quotacheck
      operation, dquot reclaim cannot possibly complete a dquot flush
      before quotacheck completes.
      
      Therefore, quotacheck must submit the buffer for I/O in order to
      cycle the flush lock and flush the dirty in-core dquot to the
      buffer. Add a delwri queue buffer push mechanism to submit an
      individual buffer for I/O without losing the delwri queue status and
      use it from quotacheck to avoid the deadlock. This restores
      quotacheck behavior to as before the regression was introduced.
      Reported-by: default avatarMartin Svec <martin.svec@zoner.cz>
      Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
      Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      7912e7fe
  22. 31 May, 2017 1 commit
    • Brian Foster's avatar
      xfs: use ->b_state to fix buffer I/O accounting release race · 63db7c81
      Brian Foster authored
      We've had user reports of unmount hangs in xfs_wait_buftarg() that
      analysis shows is due to btp->bt_io_count == -1. bt_io_count
      represents the count of in-flight asynchronous buffers and thus
      should always be >= 0. xfs_wait_buftarg() waits for this value to
      stabilize to zero in order to ensure that all untracked (with
      respect to the lru) buffers have completed I/O processing before
      unmount proceeds to tear down in-core data structures.
      
      The value of -1 implies an I/O accounting decrement race. Indeed,
      the fact that xfs_buf_ioacct_dec() is called from xfs_buf_rele()
      (where the buffer lock is no longer held) means that bp->b_flags can
      be updated from an unsafe context. While a user-level reproducer is
      currently not available, some intrusive hacks to run racing buffer
      lookups/ioacct/releases from multiple threads was used to
      successfully manufacture this problem.
      
      Existing callers do not expect to acquire the buffer lock from
      xfs_buf_rele(). Therefore, we can not safely update ->b_flags from
      this context. It turns out that we already have separate buffer
      state bits and associated serialization for dealing with buffer LRU
      state in the form of ->b_state and ->b_lock. Therefore, replace the
      _XBF_IN_FLIGHT flag with a ->b_state variant, update the I/O
      accounting wrappers appropriately and make sure they are used with
      the correct locking. This ensures that buffer in-flight state can be
      modified at buffer release time without racing with modifications
      from a buffer lock holder.
      
      Fixes: 9c7504aa
      
       ("xfs: track and serialize in-flight async buffers against unmount")
      Cc: <stable@vger.kernel.org> # v4.8+
      Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
      Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
      Tested-by: default avatarLibor Pechacek <lpechacek@suse.com>
      Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      63db7c81
  23. 25 Apr, 2017 1 commit
  24. 03 Apr, 2017 1 commit