1. 08 Nov, 2012 10 commits
    • Dave Chinner's avatar
      xfs: fix reading of wrapped log data · 6ce377af
      Dave Chinner authored
      Commit 44396476 ("xfs: reset buffer pointers before freeing them") in
      3.0-rc1 introduced a regression when recovering log buffers that
      wrapped around the end of log. The second part of the log buffer at
      the start of the physical log was being read into the header buffer
      rather than the data buffer, and hence recovery was seeing garbage
      in the data buffer when it got to the region of the log buffer that
      was incorrectly read.
      
      Cc: <stable@vger.kernel.org> # 3.0.x, 3.2.x, 3.4.x 3.6.x
      Reported-by: default avatarTorsten Kaiser <just.for.lkml@googlemail.com>
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarMark Tinguely <tinguely@sgi.com>
      Signed-off-by: default avatarBen Myers <bpm@sgi.com>
      6ce377af
    • Dave Chinner's avatar
      xfs: fix buffer shudown reference count mismatch · 03b1293e
      Dave Chinner authored
      When we shut down the filesystem, we have to unpin and free all the
      buffers currently active in the CIL. To do this we unpin and remove
      them in one operation as a result of a failed iclogbuf write. For
      buffers, we do this removal via a simultated IO completion of after
      marking the buffer stale.
      
      At the time we do this, we have two references to the buffer - the
      active LRU reference and the buf log item.  The LRU reference is
      removed by marking the buffer stale, and the active CIL reference is
      by the xfs_buf_iodone() callback that is run by
      xfs_buf_do_callbacks() during ioend processing (via the bp->b_iodone
      callback).
      
      However, ioend processing requires one more reference - that of the
      IO that it is completing. We don't have this reference, so we free
      the buffer prematurely and use it after it is freed. For buffers
      marked with XBF_ASYNC, this leads to assert failures in
      xfs_buf_rele() on debug kernels because the b_hold count is zero.
      
      Fix this by making sure we take the necessary IO reference before
      starting IO completion processing on the stale buffer, and set the
      XBF_ASYNC flag to ensure that IO completion processing removes all
      the active references from the buffer to ensure it is fully torn
      down.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarMark Tinguely <tinguely@sgi.com>
      Signed-off-by: default avatarBen Myers <bpm@sgi.com>
      03b1293e
    • Dave Chinner's avatar
      xfs: don't vmap inode cluster buffers during free · 4b62acfe
      Dave Chinner authored
      Inode buffers do not need to be mapped as inodes are read or written
      directly from/to the pages underlying the buffer. This fixes a
      regression introduced by commit 611c9946 ("xfs: make XBF_MAPPED the
      default behaviour").
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarMark Tinguely <tinguely@sgi.com>
      Signed-off-by: default avatarBen Myers <bpm@sgi.com>
      4b62acfe
    • Dave Chinner's avatar
      xfs: invalidate allocbt blocks moved to the free list · ca250b1b
      Dave Chinner authored
      When we free a block from the alloc btree tree, we move it to the
      freelist held in the AGFL and mark it busy in the busy extent tree.
      This typically happens when we merge btree blocks.
      
      Once the transaction is committed and checkpointed, the block can
      remain on the free list for an indefinite amount of time.  Now, this
      isn't the end of the world at this point - if the free list is
      shortened, the buffer is invalidated in the transaction that moves
      it back to free space. If the buffer is allocated as metadata from
      the free list, then all the modifications getted logged, and we have
      no issues, either. And if it gets allocated as userdata direct from
      the freelist, it gets invalidated and so will never get written.
      
      However, during the time it sits on the free list, pressure on the
      log can cause the AIL to be pushed and the buffer that covers the
      block gets pushed for write. IOWs, we end up writing a freed
      metadata block to disk. Again, this isn't the end of the world
      because we know from the above we are only writing to free space.
      
      The problem, however, is for validation callbacks. If the block was
      on old btree root block, then the level of the block is going to be
      higher than the current tree root, and so will fail validation.
      There may be other inconsistencies in the block as well, and
      currently we don't care because the block is in free space. Shutting
      down the filesystem because a freed block doesn't pass write
      validation, OTOH, is rather unfriendly.
      
      So, make sure we always invalidate buffers as they move from the
      free space trees to the free list so that we guarantee they never
      get written to disk while on the free list.
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarPhil White <pwhite@sgi.com>
      Reviewed-by: default avatarMark Tinguely <tinguely@sgi.com>
      Signed-off-by: default avatarBen Myers <bpm@sgi.com>
      ca250b1b
    • Dave Chinner's avatar
      xfs: silence uninitialised f.file warning. · 1e7acbb7
      Dave Chinner authored
      Uninitialised variable build warning introduced by 2903ff01 ("switch
      simple cases of fget_light to fdget"), gcc is not smart enough to
      work out that the variable is not used uninitialised, and the commit
      removed the initialisation at declaration that the old variable had.
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarMark Tinguely <tinguely@sgi.com>
      Signed-off-by: default avatarBen Myers <bpm@sgi.com>
      1e7acbb7
    • Dave Chinner's avatar
      xfs: growfs: don't read garbage for new secondary superblocks · eaef8543
      Dave Chinner authored
      When updating new secondary superblocks in a growfs operation, the
      superblock buffer is read from the newly grown region of the
      underlying device. This is not guaranteed to be zero, so violates
      the underlying assumption that the unused parts of superblocks are
      zero filled. Get a new buffer for these secondary superblocks to
      ensure that the unused regions are zero filled correctly.
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarCarlos Maiolino <cmaiolino@redhat.com>
      Signed-off-by: default avatarBen Myers <bpm@sgi.com>
      eaef8543
    • Dave Chinner's avatar
      xfs: move allocation stack switch up to xfs_bmapi_allocate · 1f3c785c
      Dave Chinner authored
      Switching stacks are xfs_alloc_vextent can cause deadlocks when we
      run out of worker threads on the allocation workqueue. This can
      occur because xfs_bmap_btalloc can make multiple calls to
      xfs_alloc_vextent() and even if xfs_alloc_vextent() fails it can
      return with the AGF locked in the current allocation transaction.
      
      If we then need to make another allocation, and all the allocation
      worker contexts are exhausted because the are blocked waiting for
      the AGF lock, holder of the AGF cannot get it's xfs-alloc_vextent
      work completed to release the AGF.  Hence allocation effectively
      deadlocks.
      
      To avoid this, move the stack switch one layer up to
      xfs_bmapi_allocate() so that all of the allocation attempts in a
      single switched stack transaction occur in a single worker context.
      This avoids the problem of an allocation being blocked waiting for
      a worker thread whilst holding the AGF.
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarMark Tinguely <tinguely@sgi.com>
      Signed-off-by: default avatarBen Myers <bpm@sgi.com>
      1f3c785c
    • Dave Chinner's avatar
      xfs: introduce XFS_BMAPI_STACK_SWITCH · 326c0355
      Dave Chinner authored
      Certain allocation paths through xfs_bmapi_write() are in situations
      where we have limited stack available. These are almost always in
      the buffered IO writeback path when convertion delayed allocation
      extents to real extents.
      
      The current stack switch occurs for userdata allocations, which
      means we also do stack switches for preallocation, direct IO and
      unwritten extent conversion, even those these call chains have never
      been implicated in a stack overrun.
      
      Hence, let's target just the single stack overun offended for stack
      switches. To do that, introduce a XFS_BMAPI_STACK_SWITCH flag that
      the caller can pass xfs_bmapi_write() to indicate it should switch
      stacks if it needs to do allocation.
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarMark Tinguely <tinguely@sgi.com>
      Signed-off-by: default avatarBen Myers <bpm@sgi.com>
      326c0355
    • Mark Tinguely's avatar
      xfs: zero allocation_args on the kernel stack · 408cc4e9
      Mark Tinguely authored
      Zero the kernel stack space that makes up the xfs_alloc_arg structures.
      Signed-off-by: default avatarMark Tinguely <tinguely@sgi.com>
      Reviewed-by: default avatarBen Myers <bpm@sgi.com>
      Signed-off-by: default avatarBen Myers <bpm@sgi.com>
      408cc4e9
    • Dave Chinner's avatar
      xfs: only update the last_sync_lsn when a transaction completes · 7e9620f2
      Dave Chinner authored
      The log write code stamps each iclog with the current tail LSN in
      the iclog header so that recovery knows where to find the tail of
      thelog once it has found the head. Normally this is taken from the
      first item on the AIL - the log item that corresponds to the oldest
      active item in the log.
      
      The problem is that when the AIL is empty, the tail lsn is dervied
      from the the l_last_sync_lsn, which is the LSN of the last iclog to
      be written to the log. In most cases this doesn't happen, because
      the AIL is rarely empty on an active filesystem. However, when it
      does, it opens up an interesting case when the transaction being
      committed to the iclog spans multiple iclogs.
      
      That is, the first iclog is stamped with the l_last_sync_lsn, and IO
      is issued. Then the next iclog is setup, the changes copied into the
      iclog (takes some time), and then the l_last_sync_lsn is stamped
      into the header and IO is issued. This is still the same
      transaction, so the tail lsn of both iclogs must be the same for log
      recovery to find the entire transaction to be able to replay it.
      
      The problem arises in that the iclog buffer IO completion updates
      the l_last_sync_lsn with it's own LSN. Therefore, If the first iclog
      completes it's IO before the second iclog is filled and has the tail
      lsn stamped in it, it will stamp the LSN of the first iclog into
      it's tail lsn field. If the system fails at this point, log recovery
      will not see a complete transaction, so the transaction will no be
      replayed.
      
      The fix is simple - the l_last_sync_lsn is updated when a iclog
      buffer IO completes, and this is incorrect. The l_last_sync_lsn
      shoul dbe updated when a transaction is completed by a iclog buffer
      IO. That is, only iclog buffers that have transaction commit
      callbacks attached to them should update the l_last_sync_lsn. This
      means that the last_sync_lsn will only move forward when a commit
      record it written, not in the middle of a large transaction that is
      rolling through multiple iclog buffers.
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarMark Tinguely <tinguely@sgi.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarBen Myers <bpm@sgi.com>
      7e9620f2
  2. 14 Oct, 2012 6 commits
    • Linus Torvalds's avatar
      Linux 3.7-rc1 · ddffeb8c
      Linus Torvalds authored
      ddffeb8c
    • Linus Torvalds's avatar
      Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus · a5ef3f7d
      Linus Torvalds authored
      Pull MIPS update from Ralf Baechle:
       "Cleanups and fixes for breakage that occured earlier during this merge
        phase.  Also a few patches that didn't make the first pull request.
        Of those is the Alchemy work that merges code for many of the SOCs and
        evaluation boards thus among other code shrinkage, reduces the number
        of MIPS defconfigs by 5."
      
      * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (22 commits)
        MIPS: SNI: Switch RM400 serial to SCCNXP driver
        MIPS: Remove unused empty_bad_pmd_table[] declaration.
        MIPS: MT: Remove kspd.
        MIPS: Malta: Fix section mismatch.
        MIPS: asm-offset.c: Delete unused irq_cpustat_t struct offsets.
        MIPS: Alchemy: Merge PB1100/1500 support into DB1000 code.
        MIPS: Alchemy: merge PB1550 support into DB1550 code
        MIPS: Alchemy: Single kernel for DB1200/1300/1550
        MIPS: Optimize TLB refill for RI/XI configurations.
        MIPS: proc: Cleanup printing of ASEs.
        MIPS: Hardwire detection of DSP ASE Rev 2 for systems, as required.
        MIPS: Add detection of DSP ASE Revision 2.
        MIPS: Optimize pgd_init and pmd_init
        MIPS: perf: Add perf functionality for BMIPS5000
        MIPS: perf: Split the Kconfig option CONFIG_MIPS_MT_SMP
        MIPS: perf: Remove unnecessary #ifdef
        MIPS: perf: Add cpu feature bit for PCI (performance counter interrupt)
        MIPS: perf: Change the "mips_perf_event" table unsupported indicator.
        MIPS: Align swapper_pg_dir to 64K for better TLB Refill code.
        vmlinux.lds.h: Allow architectures to add sections to the front of .bss
        ...
      a5ef3f7d
    • Linus Torvalds's avatar
      Merge branch 'modules-next' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux · d25282d1
      Linus Torvalds authored
      Pull module signing support from Rusty Russell:
       "module signing is the highlight, but it's an all-over David Howells frenzy..."
      
      Hmm "Magrathea: Glacier signing key". Somebody has been reading too much HHGTTG.
      
      * 'modules-next' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux: (37 commits)
        X.509: Fix indefinite length element skip error handling
        X.509: Convert some printk calls to pr_devel
        asymmetric keys: fix printk format warning
        MODSIGN: Fix 32-bit overflow in X.509 certificate validity date checking
        MODSIGN: Make mrproper should remove generated files.
        MODSIGN: Use utf8 strings in signer's name in autogenerated X.509 certs
        MODSIGN: Use the same digest for the autogen key sig as for the module sig
        MODSIGN: Sign modules during the build process
        MODSIGN: Provide a script for generating a key ID from an X.509 cert
        MODSIGN: Implement module signature checking
        MODSIGN: Provide module signing public keys to the kernel
        MODSIGN: Automatically generate module signing keys if missing
        MODSIGN: Provide Kconfig options
        MODSIGN: Provide gitignore and make clean rules for extra files
        MODSIGN: Add FIPS policy
        module: signature checking hook
        X.509: Add a crypto key parser for binary (DER) X.509 certificates
        MPILIB: Provide a function to read raw data into an MPI
        X.509: Add an ASN.1 decoder
        X.509: Add simple ASN.1 grammar compiler
        ...
      d25282d1
    • Matt Fleming's avatar
      x86, boot: Explicitly include autoconf.h for hostprogs · b6eea87f
      Matt Fleming authored
      The hostprogs need access to the CONFIG_* symbols found in
      include/generated/autoconf.h.  But commit abbf1590 ("UAPI: Partition
      the header include path sets and add uapi/ header directories") replaced
      $(LINUXINCLUDE) with $(USERINCLUDE) which doesn't contain the necessary
      include paths.
      
      This has the undesirable effect of breaking the EFI boot stub because
      the #ifdef CONFIG_EFI_STUB code in arch/x86/boot/tools/build.c is
      never compiled.
      
      It should also be noted that because $(USERINCLUDE) isn't exported by
      the top-level Makefile it's actually empty in arch/x86/boot/Makefile.
      
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Acked-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b6eea87f
    • Ingo Molnar's avatar
      perf: Fix UAPI fallout · 7d380c8f
      Ingo Molnar authored
      The UAPI commits forgot to test tooling builds such as tools/perf/,
      and this fixes the fallout.
      
      Manual conversion.
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7d380c8f
    • Linus Torvalds's avatar
      Merge branch 'late-for-linus' of git://git.linaro.org/people/rmk/linux-arm · 3d6ee36d
      Linus Torvalds authored
      Pull ARM update from Russell King:
       "This is the final round of stuff for ARM, left until the end of the
        merge window to reduce the number of conflicts.  This set contains the
        ARM part of David Howells UAPI changes, and a fix to the ordering of
        'select' statements in ARM Kconfig files (see the appropriate commit
        for why this happened - thanks to Andrew Morton for pointing out the
        problem.)
      
        I've left this as long as I dare for this window to avoid conflicts,
        and I regenerated the config patch yesterday, posting it to our
        mailing list for review and testing.  I have several acks which
        include successful test reports for it.
      
        However, today I notice we've got new conflicts with previously unseen
        code...  though that conflict should be trivial (it's my changes vs a
        one liner.)"
      
      * 'late-for-linus' of git://git.linaro.org/people/rmk/linux-arm:
        ARM: config: make sure that platforms are ordered by option string
        ARM: config: sort select statements alphanumerically
        UAPI: (Scripted) Disintegrate arch/arm/include/asm
      
      Fix up fairly conflict in arch/arm/Kconfig (the select re-organization
      vs recent addition of GENERIC_KERNEL_EXECVE)
      3d6ee36d
  3. 13 Oct, 2012 24 commits