1. 11 11月, 2008 21 次提交
  2. 10 11月, 2008 6 次提交
    • 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
      Fix nfsd truncation of readdir results · b726e923
      Doug Nazar 提交于
      Commit 8d7c4203 "nfsd: fix failure to set eof in readdir in some
      situations" introduced a bug: on a directory in an exported ext3
      filesystem with dir_index unset, a READDIR will only return about 250
      entries, even if the directory was larger.
      
      Bisected it back to this commit; reverting it fixes the problem.
      
      It turns out that in this case ext3 reads a block at a time, then
      returns from readdir, which means we can end up with buf.full==0 but
      with more entries in the directory still to be read.  Before 8d7c4203
      (but after c002a6c7 "Optimise NFS readdir hack slightly"), this would
      cause us to return the READDIR result immediately, but with the eof bit
      unset.  That could cause a performance regression (because the client
      would need more roundtrips to the server to read the whole directory),
      but no loss in correctness, since the cleared eof bit caused the client
      to send another readdir.  After 8d7c4203, the setting of the eof bit
      made this a correctness problem.
      
      So, move nfserr_eof into the loop and remove the buf.full check so that
      we loop until buf.used==0.  The following seems to do the right thing
      and reduces the network traffic since we don't return a READDIR result
      until the buffer is full.
      
      Tested on an empty directory & large directory; eof is properly sent and
      there are no more short buffers.
      Signed-off-by: NDoug Nazar <nazard@dragoninc.ca>
      Cc: David Woodhouse <David.Woodhouse@intel.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      b726e923
  3. 07 11月, 2008 13 次提交