1. 13 7月, 2011 1 次提交
  2. 08 7月, 2011 3 次提交
  3. 20 5月, 2011 1 次提交
    • D
      xfs: reset buffer pointers before freeing them · 44396476
      Dave Chinner 提交于
      When we free a vmapped buffer, we need to ensure the vmap address
      and length we free is the same as when it was allocated. In various
      places in the log code we change the memory the buffer is pointing
      to before issuing IO, but we never reset the buffer to point back to
      it's original memory (or no memory, if that is the case for the
      buffer).
      
      As a result, when we free the buffer it points to memory that is
      owned by something else and attempts to unmap and free it. Because
      the range does not match any known mapped range, it can trigger
      BUG_ON() traps in the vmap code, and potentially corrupt the vmap
      area tracking.
      
      Fix this by always resetting these buffers to their original state
      before freeing them.
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAlex Elder <aelder@sgi.com>
      44396476
  4. 31 3月, 2011 1 次提交
  5. 07 3月, 2011 1 次提交
  6. 12 1月, 2011 1 次提交
    • D
      xfs: prevent NMI timeouts in cmn_err · 73efe4a4
      Dave Chinner 提交于
      We currently have a global error message buffer in cmn_err that is
      protected by a spin lock that disables interrupts.  Recently there
      have been reports of NMI timeouts occurring when the console is
      being flooded by SCSI error reports due to cmn_err() getting stuck
      trying to print to the console while holding this lock (i.e. with
      interrupts disabled). The NMI watchdog is seeing this CPU as
      non-responding and so is triggering a panic.  While the trigger for
      the reported case is SCSI errors, pretty much anything that spams
      the kernel log could cause this to occur.
      
      Realistically the only reason that we have the intemediate message
      buffer is to prepend the correct kernel log level prefix to the log
      message. The only reason we have the lock is to protect the global
      message buffer and the only reason the message buffer is global is
      to keep it off the stack. Hence if we can avoid needing a global
      message buffer we avoid needing the lock, and we can do this with a
      small amount of cleanup and some preprocessor tricks:
      
      	1. clean up xfs_cmn_err() panic mask functionality to avoid
      	   needing debug code in xfs_cmn_err()
      	2. remove the couple of "!" message prefixes that still exist that
      	   the existing cmn_err() code steps over.
      	3. redefine CE_* levels directly to KERN_*
      	4. redefine cmn_err() and friends to use printk() directly
      	   via variable argument length macros.
      
      By doing this, we can completely remove the cmn_err() code and the
      lock that is causing the problems, and rely solely on printk()
      serialisation to ensure that we don't get garbled messages.
      
      A series of followup patches is really needed to clean up all the
      cmn_err() calls and related messages properly, but that results in a
      series that is not easily back portable to enterprise kernels. Hence
      this initial fix is only to address the direct problem in the lowest
      impact way possible.
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAlex Elder <aelder@sgi.com>
      73efe4a4
  7. 21 12月, 2010 1 次提交
    • D
      xfs: convert l_tail_lsn to an atomic variable. · 1c3cb9ec
      Dave Chinner 提交于
      log->l_tail_lsn is currently protected by the log grant lock. The
      lock is only needed for serialising readers against writers, so we
      don't really need the lock if we make the l_tail_lsn variable an
      atomic. Converting the l_tail_lsn variable to an atomic64_t means we
      can start to peel back the grant lock from various operations.
      
      Also, provide functions to safely crack an atomic LSN variable into
      it's component pieces and to recombined the components into an
      atomic variable. Use them where appropriate.
      
      This also removes the need for explicitly holding a spinlock to read
      the l_tail_lsn on 32 bit platforms.
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      
      1c3cb9ec
  8. 03 12月, 2010 1 次提交
    • D
      xfs: convert l_last_sync_lsn to an atomic variable · 84f3c683
      Dave Chinner 提交于
      log->l_last_sync_lsn is updated in only one critical spot - log
      buffer Io completion - and is protected by the grant lock here. This
      requires the grant lock to be taken for every log buffer IO
      completion. Converting the l_last_sync_lsn variable to an atomic64_t
      means that we do not need to take the grant lock in log buffer IO
      completion to update it.
      
      This also removes the need for explicitly holding a spinlock to read
      the l_last_sync_lsn on 32 bit platforms.
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      84f3c683
  9. 21 12月, 2010 1 次提交
  10. 20 12月, 2010 2 次提交
    • D
      xfs: use AIL bulk update function to implement single updates · e6059949
      Dave Chinner 提交于
      We now have two copies of AIL insert operations that are mostly
      duplicate functionality. The single log item updates can be
      implemented via the bulk updates by turning xfs_trans_ail_update()
      into a simple wrapper. This removes all the duplicate insert
      functionality and associated helpers.
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      e6059949
    • D
      xfs: Pull EFI/EFD handling out from under the AIL lock · b199c8a4
      Dave Chinner 提交于
      EFI/EFD interactions are protected from races by the AIL lock. They
      are the only type of log items that require the the AIL lock to
      serialise internal state, so they need to be separated from the AIL
      lock before we can do bulk insert operations on the AIL.
      
      To acheive this, convert the counter of the number of extents in the
      EFI to an atomic so it can be safely manipulated by EFD processing
      without locks. Also, convert the EFI state flag manipulations to use
      atomic bit operations so no locks are needed to record state
      changes. Finally, use the state bits to determine when it is safe to
      free the EFI and clean up the code to do this neatly.
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      b199c8a4
  11. 17 12月, 2010 4 次提交
  12. 19 10月, 2010 3 次提交
  13. 27 7月, 2010 3 次提交
  14. 24 6月, 2010 1 次提交
  15. 29 5月, 2010 1 次提交
  16. 24 5月, 2010 1 次提交
  17. 19 5月, 2010 12 次提交
    • A
      xfs: kill off l_sectbb_mask · 48389ef1
      Alex Elder 提交于
      There remains only one user of the l_sectbb_mask field in the log
      structure.  Just kill it off and compute the mask where needed from
      the power-of-2 sector size.
      
      (Only update from last post is to accomodate the changes in the
      previous patch in the series.)
      Signed-off-by: NAlex Elder <aelder@sgi.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      48389ef1
    • A
      xfs: record log sector size rather than log2(that) · 69ce58f0
      Alex Elder 提交于
      Change struct log so it keeps track of the size (in basic blocks) of
      a log sector in l_sectBBsize rather than the log-base-2 of that
      value (previously, l_sectbb_log).  The name was chosen for
      consistency with the other fields in the structure that represent
      a number of basic blocks.
      
      (Updated so that a variable used in computing and verifying a log's
      sector size is named "log2_size".  Also added the "BB" to the
      structure field name, based on feedback from Eric Sandeen.  Also
      dropped some superfluous parentheses.)
      Signed-off-by: NAlex Elder <aelder@sgi.com>
      Reviewed-by: NEric Sandeen <sandeen@sandeen.net>
      69ce58f0
    • C
      xfs: remove dead XFS_LOUD_RECOVERY code · 1414a604
      Christoph Hellwig 提交于
      This can't be enabled through the build system and has been dead for
      ages.  Note that the CRC patches add back log checksumming, but the
      code is quite different from the version removed here anyway.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NDave Chinner <david@fromorbit.com>
      1414a604
    • A
      xfs: minor odds and ends in xfs_log_recover.c · 3f943d85
      Alex Elder 提交于
      Odds and ends in "xfs_log_recover.c".  This patch just contains some
      minor things that didn't seem to warrant their own individual
      patches:
      - In xlog_bread_noalign(), drop an assertion that a pointer is
        non-null (the crash will tell us it was a bad pointer).
      - Add a more descriptive header comment for xlog_find_verify_cycle().
      - Make a few additions to the comments in xlog_find_head().  Also
        rearrange some expressions in a few spots to produce the same
        result, but in a way that seems more clear what's being computed.
      
      (Updated in response to Dave's review comments.  Note I did not
      split this patch like I said I would.)
      Signed-off-by: NAlex Elder <aelder@sgi.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      3f943d85
    • A
      xfs: avoid repeated pointer dereferences · e3bb2e30
      Alex Elder 提交于
      In xlog_find_cycle_start() use a local variable for some repeated
      operations rather than constantly accessing the memory location
      whose address is passed in.
      
      (This version drops an assertion that a pointer is non-null.)
      Signed-off-by: NAlex Elder <aelder@sgi.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      e3bb2e30
    • A
      xfs: change a few labels in xfs_log_recover.c · 9db127ed
      Alex Elder 提交于
      Rename a label used in xlog_find_head() that I thought was poorly
      chosen.  Also combine two adjacent labels xlog_find_tail() into a
      single label, and give it a more generic name.
      
      (Now using Dave's suggested "validate_head" name for first label.)
      Signed-off-by: NAlex Elder <aelder@sgi.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      9db127ed
    • A
      xfs: nothing special about 1-block log sector · 36adecff
      Alex Elder 提交于
      There are a number of places where a log sector size of 1 uses
      special case code.  The round_up() and round_down() macros
      produce the correct result even when the log sector size is 1, and
      this eliminates the need for treating this as a special case.
      Signed-off-by: NAlex Elder <aelder@sgi.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      36adecff
    • A
      xfs: encapsulate bbcount validity checking · ff30a622
      Alex Elder 提交于
      Define a function that encapsulates checking the validity of a log
      block count.
      
      (Updated from previous version--no longer includes error reporting in the
      encapsulated validation function.)
      Signed-off-by: NAlex Elder <aelder@sgi.com>
      Reviewed-by: NDave Chinner <dchinner@redhat.com>
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      ff30a622
    • A
      xfs: kill XLOG_SECTOR_ROUND*() · 5c17f533
      Alex Elder 提交于
      XLOG_SECTOR_ROUNDUP_BBCOUNT() and XLOG_SECTOR_ROUNDDOWN_BLKNO()
      are now fairly simple macro translations.  Just get rid of them in
      favor of the round_up() and round_down() macro calls they represent.
      
      Also, in spots in xlog_get_bp() and xlog_write_log_records(),
      round_up() was being called with value 1, which just evaluates
      to the macro's second argument; so just use that instead.
      In the latter case, make use of that value, as long as it's
      already been computed.
      Signed-off-by: NAlex Elder <aelder@sgi.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      5c17f533
    • A
      xfs: simplify XLOG_SECTOR_ROUND*() · 8511998b
      Alex Elder 提交于
      XLOG_SECTOR_ROUNDUP_BBCOUNT() is defined in "fs/xfs/xfs_log_recover.c"
      in an overly-complicated way.  It is basically roundup(), but that
      is not at all clear from its definition.  (Actually, there is
      another macro round_up() that applies for power-of-two-based masks
      which I'll be using here.)
      
      The operands in XLOG_SECTOR_ROUNDUP_BBCOUNT() are basically the
      block number (bbs) and the log sector basic block mask
      (log->l_sectbb_mask).  I'll call them B and M for this discussion.
      
      The macro computes is value this way:
      	M && (B & M) ? (B + M + 1) & ~M : B
      
      Put another way, we can break it into 3 cases:
      	1)  ! M          -> B			# 0 mask, no effect
      	2)  ! (B & M)    -> B			# sector aligned
      	3)  M && (B & M) -> (B + M + 1) & ~M	# round up otherwise
      
      The round_up() macro is cleverly defined using a value, v, and a
      power-of-2, p, and the result is the nearest multiple of p greater
      than or equal to v.  Its value is computed something like this:
      	((v - 1) | (p - 1)) + 1
      Let's consider using this in the context of the 3 cases above.
      
      When p = 2^0 = 1, the result boils down to ((v - 1) | 0) + 1, so it
      just translates any value v to itself.  That handles case (1) above.
      
      When p = 2^n, n > 0, we know that (p - 1) will be a mask with all n
      bits 0..n-1 set.  The condition in this case occurs when none of
      those mask bits is set in the value v provided.  If that is the
      case, subtracting 1 from v will have 1's in all those lower bits (at
      least).  Therefore, OR-ing the mask with that decremented value has
      no effect, so adding the 1 back again will just translate the v to
      itself.  This handles case (2).
      
      Otherwise, the value v is greater than some multiple of p, and
      decrementing it will produce a result greater than or equal to that
      multiple.  OR-ing in the mask will produce a value 1 less than the
      next multiple of p, so finally adding 1 back will result in the
      desired rounded-up value.  This handles case (3).
      
      Hopefully this is convincing.
      
      While I was at it, I converted XLOG_SECTOR_ROUNDDOWN_BLKNO() to use
      the round_down() macro.
      Signed-off-by: NAlex Elder <aelder@sgi.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      8511998b
    • A
      xfs: fix min bufsize bugs in two places · 6881a229
      Alex Elder 提交于
      This fixes a bug in two places that I found by inspection.  In
      xlog_find_verify_cycle() and xlog_write_log_records(), the code
      attempts to allocate a buffer to hold as many blocks as possible.
      It gives up if the number of blocks to be allocated gets too small.
      Right now it uses log->l_sectbb_log as that lower bound, but I'm
      sure it's supposed to be the actual log sector size instead.  That
      is, the lower bound should be (1 << log->l_sectbb_log).
      
      Also define a simple macro xlog_sectbb(log) to represent the number
      of basic blocks in a sector for the given log.
      
      (No change from original submission; I have implemented Christoph's
      suggestion about storing l_sectsize rather than l_sectbb_log in
      a new, separate patch in this series.)
      Signed-off-by: NAlex Elder <aelder@sgi.com>
      Reviewed-by: NDave Chinner <dchinner@redhat.com>
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      6881a229
    • D
      xfs: add log item recovery tracing · 9abbc539
      Dave Chinner 提交于
      Currently there is no tracing in log recovery, so it is difficult to
      determine what is going on when something goes wrong.
      
      Add tracing for log item recovery to provide visibility into the log
      recovery process. The tracing added shows regions being extracted
      from the log transactions and added to the transaction hash forming
      recovery items, followed by the reordering, cancelling and finally
      recovery of the items.
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      9abbc539
  18. 22 1月, 2010 2 次提交