1. 01 12月, 2008 17 次提交
  2. 17 11月, 2008 1 次提交
    • D
      [XFS] Fix double free of log tickets · cc09c0dc
      Dave Chinner 提交于
      When an I/O error occurs during an intermediate commit on a rolling
      transaction, xfs_trans_commit() will free the transaction structure
      and the related ticket. However, the duplicate transaction that
      gets used as the transaction continues still contains a pointer
      to the ticket. Hence when the duplicate transaction is cancelled
      and freed, we free the ticket a second time.
      
      Add reference counting to the ticket so that we hold an extra
      reference to the ticket over the transaction commit. We drop the
      extra reference once we have checked that the transaction commit
      did not return an error, thus avoiding a double free on commit
      error.
      
      Credit to Nick Piggin for tripping over the problem.
      
      SGI-PV: 989741
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NLachlan McIlroy <lachlan@sgi.com>
      cc09c0dc
  3. 10 11月, 2008 8 次提交
    • D
      [XFS] XFS: Check for valid transaction headers in recovery · 220ca310
      David Chinner 提交于
      When we are about to add a new item to a transaction in recovery, we need
      to check that it is valid first. Currently we just assert that header
      magic number matches, but in production systems that is not present and we
      add a corrupted transaction to the list to be processed. This results in a
      kernel oops later when processing the corrupted transaction.
      
      Instead, if we detect a corrupted transaction, abort recovery and leave
      the user to clean up the mess that has occurred.
      
      SGI-PV: 988145
      
      SGI-Modid: xfs-linux-melb:xfs-kern:32356a
      Signed-off-by: NDavid Chinner <david@fromorbit.com>
      Signed-off-by: NTim Shimmin <tes@sgi.com>
      Signed-off-by: NEric Sandeen <sandeen@sandeen.net>
      Signed-off-by: NLachlan McIlroy <lachlan@sgi.com>
      220ca310
    • D
      [XFS] handle memory allocation failures during log initialisation · 8f330f51
      Dave Chinner 提交于
      When there is no memory left in the system, xfs_buf_get_noaddr()
      can fail. If this happens at mount time during xlog_alloc_log()
      we fail to catch the error and oops.
      
      Catch the error from xfs_buf_get_noaddr(), and allow other memory
      allocations to fail and catch those errors too. Report the error
      to the console and fail the mount with ENOMEM.
      
      Tested by manually injecting errors into xfs_buf_get_noaddr() and
      xlog_alloc_log().
      
      Version 2:
      o remove unnecessary casts of the returned pointer from kmem_zalloc()
      
      SGI-PV: 987246
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NLachlan McIlroy <lachlan@sgi.com>
      8f330f51
    • D
      [XFS] Account for allocated blocks when expanding directories · 6f9f51ad
      David Chinner 提交于
      When we create a directory, we reserve a number of blocks for the maximum
      possible expansion of of the directory due to various btree splits,
      freespace allocation, etc. Unfortunately, each allocation is not reflected
      in the total number of blocks still available to the transaction, so the
      maximal reservation is used over and over again.
      
      This leads to problems where an allocation group has only enough blocks
      for *some* of the allocations required for the directory modification.
      After the first N allocations, the remaining blocks in the allocation
      group drops below the total reservation, and subsequent allocations fail
      because the allocator will not allow the allocation to proceed if the AG
      does not have the enough blocks available for the entire allocation total.
      
      This results in an ENOSPC occurring after an allocation has already
      occurred. This results in aborting the directory operation (leaving the
      directory in an inconsistent state) and cancelling a dirty transaction,
      which results in a filesystem shutdown.
      
      Avoid the problem by reflecting the number of blocks allocated in any
      directory expansion in the total number of blocks available to the
      modification in progress. This prevents a directory modification from
      being aborted part way through with an ENOSPC.
      
      SGI-PV: 988144
      
      SGI-Modid: xfs-linux-melb:xfs-kern:32340a
      Signed-off-by: NDavid Chinner <david@fromorbit.com>
      Signed-off-by: NLachlan McIlroy <lachlan@sgi.com>
      6f9f51ad
    • L
      [XFS] Wait for all I/O on truncate to zero file size · 2cf7f0da
      Lachlan McIlroy 提交于
      It's possible to have outstanding xfs_ioend_t's queued when the file size
      is zero. This can happen in the direct I/O path when a direct I/O write
      fails due to ENOSPC. In this case the xfs_ioend_t will still be queued (ie
      xfs_end_io_direct() does not know that the I/O failed so can't force the
      xfs_ioend_t to be flushed synchronously).
      
      When we truncate a file on unlink we don't know to wait for these
      xfs_ioend_ts and we can have a use-after-free situation if the inode is
      reclaimed before the xfs_ioend_t is finally processed.
      
      As was suggested by Dave Chinner lets wait for all I/Os to complete when
      truncating the file size to zero.
      
      SGI-PV: 981668
      
      SGI-Modid: xfs-linux-melb:xfs-kern:32216a
      Signed-off-by: NLachlan McIlroy <lachlan@sgi.com>
      Signed-off-by: NChristoph Hellwig <hch@infradead.org>
      2cf7f0da
    • L
      [XFS] Fix use-after-free with log and quotas · 9ccbece5
      Lachlan McIlroy 提交于
      Destroying the quota stuff on unmount can access the log - ie
      XFS_QM_DONE() ends up in xfs_dqunlock() which calls
      xfs_trans_unlocked_item() and then xfs_log_move_tail(). By this time the
      log has already been destroyed. Just move the cleanup of the quota code
      earlier in xfs_unmountfs() before the call to xfs_log_unmount(). Moving
      XFS_QM_DONE() up near XFS_QM_DQPURGEALL() seems like a good spot.
      
      SGI-PV: 987086
      
      SGI-Modid: xfs-linux-melb:xfs-kern:32148a
      Signed-off-by: NLachlan McIlroy <lachlan@sgi.com>
      Signed-off-by: NChristoph Hellwig <hch@infradead.org>
      Signed-off-by: NPeter Leckie <pleckie@sgi.com>
      9ccbece5
    • D
      [XFS] Avoid using inodes that haven't been completely initialised · 6307091f
      Dave Chinner 提交于
      The radix tree walks in xfs_sync_inodes_ag and xfs_qm_dqrele_all_inodes()
      can find inodes that are still undergoing initialisation. Avoid
      them by checking for the the XFS_INEW() flag once we have a reference
      on the inode. This flag is cleared once the inode is properly initialised.
      
      SGI-PV: 987246
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      Signed-off-by: NLachlan McIlroy <lachlan@sgi.com>
      6307091f
    • D
      [XFS] fix uninitialised variable bug in dquot release · cb4f0d1d
      Dave Chinner 提交于
      gcc on ARM warns about an using an uninitialised variable
      in xfs_qm_dqrele_all_inodes(). This is a real bug, but gcc
      on x86_64 is not reporting this warning so it went unnoticed.
      
      Fix the bug by bring the inode radix tree walk code up to
      date with xfs_sync_inodes_ag().
      
      SGI-PV: 987246
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NLachlan McIlroy <lachlan@sgi.com>
      cb4f0d1d
    • D
      [XFS] handle memory allocation failures during log initialisation · 644c3567
      Dave Chinner 提交于
      When there is no memory left in the system, xfs_buf_get_noaddr()
      can fail. If this happens at mount time during xlog_alloc_log()
      we fail to catch the error and oops.
      
      Catch the error from xfs_buf_get_noaddr(), and allow other memory
      allocations to fail and catch those errors too. Report the error
      to the console and fail the mount with ENOMEM.
      
      Tested by manually injecting errors into xfs_buf_get_noaddr() and
      xlog_alloc_log().
      
      Version 2:
      o remove unnecessary casts of the returned pointer from kmem_zalloc()
      
      SGI-PV: 987246
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NLachlan McIlroy <lachlan@sgi.com>
      644c3567
  4. 31 10月, 2008 1 次提交
  5. 30 10月, 2008 13 次提交