1. 17 1月, 2018 1 次提交
    • B
      xfs: cancel tx on xfs_defer_finish() error during xattr set/remove · c4685628
      Brian Foster 提交于
      Chris Dunlop reports a problem where an xattr operation fails,
      reports the following error to syslog and hangs during unmount:
      
       ================================================
       [ BUG: lock held when returning to user space! ]
       ...
       ------------------------------------------------
       <PID> is leaving the kernel with locks still held!
       1 lock held by <PID>:
        #0:  (sb_internal){......}, at: [<ffffffffa07692a3>] xfs_trans_alloc+0xe3/0x130 [xfs]
      
      The failure/shutdown occurs during deferred ops processing which
      leads to an error return from xfs_defer_finish() via
      xfs_attr_leaf_addname(). While the root cause of the failure is
      unknown corruption, the cause of the subsequent BUG above and
      unmount hang is failure to cancel the transaction before returning
      to userspace.
      
      The transaction is not cancelled because the out_defer_cancel error
      handling paths in the xfs_attr_[leaf|node]_[add|remove]name()
      functions clear args.trans without releasing the transaction. The
      callers therefore lose the reference to the transaction and fail to
      cancel it.
      
      Since xfs_attr_[set|remove]() always cancel args.trans when != NULL
      and xfs_defer_finish()->...->xfs_trans_roll() should always return
      with a valid transaction, update the leaf/node xattr functions to
      not reset args.trans in the error path responsible for cancelling
      deferred ops.
      Reported-by: NChris Dunlop <chris@onthe.net.au>
      Signed-off-by: NBrian Foster <bfoster@redhat.com>
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      c4685628
  2. 13 1月, 2018 6 次提交
  3. 10 1月, 2018 2 次提交
    • D
      xfs: clarify units in the failed metadata io message · c219b015
      Darrick J. Wong 提交于
      If a metadata IO error happens, we report the location of the failed IO
      request in units of daddrs.  However, the printk message misleads people
      into thinking that the units are fs blocks, so fix the reported units.
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: NDave Chinner <dchinner@redhat.com>
      c219b015
    • D
      xfs: harden directory integrity checks some more · 46c59736
      Darrick J. Wong 提交于
      If a malicious filesystem image contains a block+ format directory
      wherein the directory inode's core.mode is set such that
      S_ISDIR(core.mode) == 0, and if there are subdirectories of the
      corrupted directory, an attempt to traverse up the directory tree will
      crash the kernel in __xfs_dir3_data_check.  Running the online scrub's
      parent checks will tend to do this.
      
      The crash occurs because the directory inode's d_ops get set to
      xfs_dir[23]_nondir_ops (it's not a directory) but the parent pointer
      scrubber's indiscriminate call to xfs_readdir proceeds past the ASSERT
      if we have non fatal asserts configured.
      
      Fix the null pointer dereference crash in __xfs_dir3_data_check by
      looking for S_ISDIR or wrong d_ops; and teach the parent scrubber
      to bail out if it is fed a non-directory "parent".
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: NBrian Foster <bfoster@redhat.com>
      46c59736
  4. 09 1月, 2018 31 次提交