1. 17 4月, 2010 1 次提交
    • D
      xfs: ensure that sync updates the log tail correctly · b6f8dd49
      Dave Chinner 提交于
      Updates to the VFS layer removed an extra ->sync_fs call into the
      filesystem during the sync process (from the quota code).
      Unfortunately the sync code was unknowingly relying on this call to
      make sure metadata buffers were flushed via a xfs_buftarg_flush()
      call to move the tail of the log forward in memory before the final
      transactions of the sync process were issued.
      
      As a result, the old code would write a very recent log tail value
      to the log by the end of the sync process, and so a subsequent crash
      would leave nothing for log recovery to do. Hence in qa test 182,
      log recovery only replayed a small handle for inode fsync
      transactions in this case.
      
      However, with the removal of the extra ->sync_fs call, the log tail
      was now not moved forward with the inode fsync transactions near the
      end of the sync procese the first (and only) buftarg flush occurred
      after these transactions went to disk. The result is that log
      recovery now sees a large number of transactions for metadata that
      is already on disk.
      
      This usually isn't a problem, but when the transactions include
      inode chunk allocation, the inode create transactions and all
      subsequent changes are replayed as we cannt rely on what is on disk
      is valid. As a result, if the inode was written and contains
      unlogged changes, the unlogged changes are lost, thereby violating
      sync semantics.
      
      The fix is to always issue a transaction after the buftarg flush
      occurs is the log iѕ not idle or covered. This results in a dummy
      transaction being written that contains the up-to-date log tail
      value, which will be very recent. Indeed, it will be at least as
      recent as the old code would have left on disk, so log recovery
      will behave exactly as it used to in this situation.
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAlex Elder <aelder@sgi.com>
      b6f8dd49
  2. 02 3月, 2010 1 次提交
  3. 22 1月, 2010 2 次提交
  4. 16 1月, 2010 1 次提交
  5. 17 12月, 2009 1 次提交
  6. 15 12月, 2009 1 次提交
    • C
      xfs: event tracing support · 0b1b213f
      Christoph Hellwig 提交于
      Convert the old xfs tracing support that could only be used with the
      out of tree kdb and xfsidbg patches to use the generic event tracer.
      
      To use it make sure CONFIG_EVENT_TRACING is enabled and then enable
      all xfs trace channels by:
      
         echo 1 > /sys/kernel/debug/tracing/events/xfs/enable
      
      or alternatively enable single events by just doing the same in one
      event subdirectory, e.g.
      
         echo 1 > /sys/kernel/debug/tracing/events/xfs/xfs_ihold/enable
      
      or set more complex filters, etc. In Documentation/trace/events.txt
      all this is desctribed in more detail.  To reads the events do a
      
         cat /sys/kernel/debug/tracing/trace
      
      Compared to the last posting this patch converts the tracing mostly to
      the one tracepoint per callsite model that other users of the new
      tracing facility also employ.  This allows a very fine-grained control
      of the tracing, a cleaner output of the traces and also enables the
      perf tool to use each tracepoint as a virtual performance counter,
           allowing us to e.g. count how often certain workloads git various
           spots in XFS.  Take a look at
      
          http://lwn.net/Articles/346470/
      
      for some examples.
      
      Also the btree tracing isn't included at all yet, as it will require
      additional core tracing features not in mainline yet, I plan to
      deliver it later.
      
      And the really nice thing about this patch is that it actually removes
      many lines of code while adding this nice functionality:
      
       fs/xfs/Makefile                |    8
       fs/xfs/linux-2.6/xfs_acl.c     |    1
       fs/xfs/linux-2.6/xfs_aops.c    |   52 -
       fs/xfs/linux-2.6/xfs_aops.h    |    2
       fs/xfs/linux-2.6/xfs_buf.c     |  117 +--
       fs/xfs/linux-2.6/xfs_buf.h     |   33
       fs/xfs/linux-2.6/xfs_fs_subr.c |    3
       fs/xfs/linux-2.6/xfs_ioctl.c   |    1
       fs/xfs/linux-2.6/xfs_ioctl32.c |    1
       fs/xfs/linux-2.6/xfs_iops.c    |    1
       fs/xfs/linux-2.6/xfs_linux.h   |    1
       fs/xfs/linux-2.6/xfs_lrw.c     |   87 --
       fs/xfs/linux-2.6/xfs_lrw.h     |   45 -
       fs/xfs/linux-2.6/xfs_super.c   |  104 ---
       fs/xfs/linux-2.6/xfs_super.h   |    7
       fs/xfs/linux-2.6/xfs_sync.c    |    1
       fs/xfs/linux-2.6/xfs_trace.c   |   75 ++
       fs/xfs/linux-2.6/xfs_trace.h   | 1369 +++++++++++++++++++++++++++++++++++++++++
       fs/xfs/linux-2.6/xfs_vnode.h   |    4
       fs/xfs/quota/xfs_dquot.c       |  110 ---
       fs/xfs/quota/xfs_dquot.h       |   21
       fs/xfs/quota/xfs_qm.c          |   40 -
       fs/xfs/quota/xfs_qm_syscalls.c |    4
       fs/xfs/support/ktrace.c        |  323 ---------
       fs/xfs/support/ktrace.h        |   85 --
       fs/xfs/xfs.h                   |   16
       fs/xfs/xfs_ag.h                |   14
       fs/xfs/xfs_alloc.c             |  230 +-----
       fs/xfs/xfs_alloc.h             |   27
       fs/xfs/xfs_alloc_btree.c       |    1
       fs/xfs/xfs_attr.c              |  107 ---
       fs/xfs/xfs_attr.h              |   10
       fs/xfs/xfs_attr_leaf.c         |   14
       fs/xfs/xfs_attr_sf.h           |   40 -
       fs/xfs/xfs_bmap.c              |  507 +++------------
       fs/xfs/xfs_bmap.h              |   49 -
       fs/xfs/xfs_bmap_btree.c        |    6
       fs/xfs/xfs_btree.c             |    5
       fs/xfs/xfs_btree_trace.h       |   17
       fs/xfs/xfs_buf_item.c          |   87 --
       fs/xfs/xfs_buf_item.h          |   20
       fs/xfs/xfs_da_btree.c          |    3
       fs/xfs/xfs_da_btree.h          |    7
       fs/xfs/xfs_dfrag.c             |    2
       fs/xfs/xfs_dir2.c              |    8
       fs/xfs/xfs_dir2_block.c        |   20
       fs/xfs/xfs_dir2_leaf.c         |   21
       fs/xfs/xfs_dir2_node.c         |   27
       fs/xfs/xfs_dir2_sf.c           |   26
       fs/xfs/xfs_dir2_trace.c        |  216 ------
       fs/xfs/xfs_dir2_trace.h        |   72 --
       fs/xfs/xfs_filestream.c        |    8
       fs/xfs/xfs_fsops.c             |    2
       fs/xfs/xfs_iget.c              |  111 ---
       fs/xfs/xfs_inode.c             |   67 --
       fs/xfs/xfs_inode.h             |   76 --
       fs/xfs/xfs_inode_item.c        |    5
       fs/xfs/xfs_iomap.c             |   85 --
       fs/xfs/xfs_iomap.h             |    8
       fs/xfs/xfs_log.c               |  181 +----
       fs/xfs/xfs_log_priv.h          |   20
       fs/xfs/xfs_log_recover.c       |    1
       fs/xfs/xfs_mount.c             |    2
       fs/xfs/xfs_quota.h             |    8
       fs/xfs/xfs_rename.c            |    1
       fs/xfs/xfs_rtalloc.c           |    1
       fs/xfs/xfs_rw.c                |    3
       fs/xfs/xfs_trans.h             |   47 +
       fs/xfs/xfs_trans_buf.c         |   62 -
       fs/xfs/xfs_vnodeops.c          |    8
       70 files changed, 2151 insertions(+), 2592 deletions(-)
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAlex Elder <aelder@sgi.com>
      0b1b213f
  7. 12 8月, 2009 2 次提交
  8. 07 4月, 2009 2 次提交
    • D
      xfs: inform the xfsaild of the push target before sleeping · 9d7fef74
      Dave Chinner 提交于
      When trying to reserve log space, we find the amount of space
      we need, then go to sleep waiting for space. When we are
      woken, we try to push the tail of the log forward to make
      sure we have space available.
      
      Unfortunately, this means that if there is not space available, and
      everyone who needs space goes to sleep there is no-one left to push
      the tail of the log to make space available. Once we have a thread
      waiting for space to become available, the others queue up behind
      it in a FIFO, and none of them push the tail of the log.
      
      This can result in everyone going to sleep in xlog_grant_log_space()
      if the first sleeper races with the last I/O that moves the tail
      of the log forward. With no further I/O tomove the tail of the log,
      there is nothing to wake the sleepers and hence all transactions
      just stop.
      
      Fix this by making sure the xfsaild will create enough space for the
      transaction that is about to sleep by moving the push target far
      enough forwards to ensure that that the curent proceeees will have
      enough space available when it is woken. That is, we push the
      AIL before we go to sleep.
      
      Because we've inserted the log ticket into the queue before we've
      pushed and gone to sleep, subsequent transactions will wait behind
      this one. Hence we are guaranteed to have space available when we
      are woken.
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      9d7fef74
    • D
      xfs: validate log feature fields correctly · a6cb767e
      Dave Chinner 提交于
      If the large log sector size feature bit is set in the
      superblock by accident (say disk corruption), the then
      fields that are now considered valid are not checked on
      production kernels. The checks are present as ASSERT
      statements so cause a panic on a debug kernel.
      
      Change this so that the fields are validity checked if
      the feature bit is set and abort the log mount if the
      fields do not contain valid values.
      Reported-by: NEric Sesterhenn <snakebyte@gmx.de>
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      a6cb767e
  9. 29 3月, 2009 1 次提交
  10. 16 3月, 2009 1 次提交
  11. 13 2月, 2009 1 次提交
  12. 09 2月, 2009 1 次提交
  13. 04 12月, 2008 1 次提交
    • C
      reduce l_icloglock roundtrips · 39e2defe
      Christoph Hellwig 提交于
      All but one caller of xlog_state_want_sync drop and re-acquire
      l_icloglock around the call to it, just so that xlog_state_want_sync can
      acquire and drop it.
      
      Move all lock operation out of l_icloglock and assert that the lock is
      held when it is called.
      
      Note that it would make sense to extende this scheme to
      xlog_state_release_iclog, but the locking in there is more complicated
      and we'd like to keep the atomic_dec_and_lock optmization for those
      callers not having l_icloglock yet.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NDave Chinner <david@fromorbit.com>
      Signed-off-by: NNiv Sardi <xaiki@sgi.com>
      39e2defe
  14. 01 12月, 2008 2 次提交
  15. 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
  16. 10 11月, 2008 2 次提交
  17. 30 10月, 2008 5 次提交
    • D
      [XFS] Finish removing the mount pointer from the AIL API · 783a2f65
      David Chinner 提交于
      Change all the remaining AIL API functions that are passed struct
      xfs_mount pointers to pass pointers directly to the struct xfs_ail being
      used. With this conversion, all external access to the AIL is via the
      struct xfs_ail. Hence the operation and referencing of the AIL is almost
      entirely independent of the xfs_mount that is using it - it is now much
      more tightly tied to the log and the items it is tracking in the log than
      it is tied to the xfs_mount.
      
      SGI-PV: 988143
      
      SGI-Modid: xfs-linux-melb:xfs-kern:32353a
      Signed-off-by: NDavid Chinner <david@fromorbit.com>
      Signed-off-by: NLachlan McIlroy <lachlan@sgi.com>
      Signed-off-by: NChristoph Hellwig <hch@infradead.org>
      783a2f65
    • D
      [XFS] Given the log a pointer to the AIL · a9c21c1b
      David Chinner 提交于
      When we need to go from the log to the AIL, we have to go via the
      xfs_mount. Add a xfs_ail pointer to the log so we can go directly to the
      AIL associated with the log.
      
      SGI-PV: 988143
      
      SGI-Modid: xfs-linux-melb:xfs-kern:32351a
      Signed-off-by: NDavid Chinner <david@fromorbit.com>
      Signed-off-by: NLachlan McIlroy <lachlan@sgi.com>
      Signed-off-by: NChristoph Hellwig <hch@infradead.org>
      a9c21c1b
    • D
      [XFS] Move the AIL lock into the struct xfs_ail · c7e8f268
      David Chinner 提交于
      Bring the ail lock inside the struct xfs_ail. This means the AIL can be
      entirely manipulated via the struct xfs_ail rather than needing both the
      struct xfs_mount and the struct xfs_ail.
      
      SGI-PV: 988143
      
      SGI-Modid: xfs-linux-melb:xfs-kern:32350a
      Signed-off-by: NDavid Chinner <david@fromorbit.com>
      Signed-off-by: NLachlan McIlroy <lachlan@sgi.com>
      Signed-off-by: NChristoph Hellwig <hch@infradead.org>
      c7e8f268
    • D
      [XFS] move the AIl traversal over to a consistent interface · 5b00f14f
      David Chinner 提交于
      With the new cursor interface, it makes sense to make all the traversing
      code use the cursor interface and make the old one go away. This means
      more of the AIL interfacing is done by passing struct xfs_ail pointers
      around the place instead of struct xfs_mount pointers.
      
      We can replace the use of xfs_trans_first_ail() in xfs_log_need_covered()
      as it is only checking if the AIL is empty. We can do that with a call to
      xfs_trans_ail_tail() instead, where a zero LSN returned indicates and
      empty AIL...
      
      SGI-PV: 988143
      
      SGI-Modid: xfs-linux-melb:xfs-kern:32348a
      Signed-off-by: NDavid Chinner <david@fromorbit.com>
      Signed-off-by: NLachlan McIlroy <lachlan@sgi.com>
      Signed-off-by: NChristoph Hellwig <hch@infradead.org>
      5b00f14f
    • D
      [XFS] Use a cursor for AIL traversal. · 27d8d5fe
      David Chinner 提交于
      To replace the current generation number ensuring sanity of the AIL
      traversal, replace it with an external cursor that is linked to the AIL.
      
      Basically, we store the next item in the cursor whenever we want to drop
      the AIL lock to do something to the current item. When we regain the lock.
      the current item may already be free, so we can't reference it, but the
      next item in the traversal is already held in the cursor.
      
      When we move or delete an object, we search all the active cursors and if
      there is an item match we clear the cursor(s) that point to the object.
      This forces the traversal to restart transparently.
      
      We don't invalidate the cursor on insert because the cursor still points
      to a valid item. If the intem is inserted between the current item and the
      cursor it does not matter; the traversal is considered to be past the
      insertion point so it will be picked up in the next traversal.
      
      Hence traversal restarts pretty much disappear altogether with this method
      of traversal, which should substantially reduce the overhead of pushing on
      a busy AIL.
      
      Version 2 o add restart logic o comment cursor interface o minor cleanups
      
      SGI-PV: 988143
      
      SGI-Modid: xfs-linux-melb:xfs-kern:32347a
      Signed-off-by: NDavid Chinner <david@fromorbit.com>
      Signed-off-by: NLachlan McIlroy <lachlan@sgi.com>
      Signed-off-by: NChristoph Hellwig <hch@infradead.org>
      27d8d5fe
  18. 11 10月, 2008 1 次提交
  19. 17 9月, 2008 2 次提交
  20. 13 8月, 2008 4 次提交
  21. 28 7月, 2008 3 次提交
  22. 12 7月, 2008 1 次提交
    • D
      Fix reference counting race on log buffers · 49641f1a
      Dave Chinner 提交于
      When we release the iclog, we do an atomic_dec_and_lock to determine if
      we are the last reference and need to trigger update of log headers and
      writeout.  However, in xlog_state_get_iclog_space() we also need to
      check if we have the last reference count there.  If we do, we release
      the log buffer, otherwise we decrement the reference count.
      
      But the compare and decrement in xlog_state_get_iclog_space() is not
      atomic, so both places can see a reference count of 2 and neither will
      release the iclog.  That leads to a filesystem hang.
      
      Close the race by replacing the atomic_read() and atomic_dec() pair with
      atomic_add_unless() to ensure that they are executed atomically.
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      Reviewed-by: NTim Shimmin <tes@sgi.com>
      Tested-by: NEric Sandeen <sandeen@sandeen.net>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      49641f1a
  23. 18 4月, 2008 3 次提交