1. 19 2月, 2014 2 次提交
    • E
      xfs: skip verification on initial "guess" superblock read · daba5427
      Eric Sandeen 提交于
      When xfs_readsb() does the very first read of the superblock,
      it makes a guess at the length of the buffer, based on the
      sector size of the underlying storage.  This may or may
      not match the filesystem sector size in sb_sectsize, so
      we can't i.e. do a CRC check on it; it might be too short.
      
      In fact, mounting a filesystem with sb_sectsize larger
      than the device sector size will cause a mount failure
      if CRCs are enabled, because we are checksumming a length
      which exceeds the buffer passed to it.
      
      So always read twice; the first time we read with NULL
      buffer ops to skip verification; then set the proper
      read length, hook up the proper verifier, and give it
      another go.
      
      Once we are sure that we've got the right buffer length,
      we can also use bp->b_length in the xfs_sb_read_verify,
      rather than the less-trusted on-disk sectorsize for
      secondary superblocks.  Before this we ran the risk of
      passing junk to the crc32c routines, which didn't always
      handle extreme values.
      Signed-off-by: NEric Sandeen <sandeen@redhat.com>
      Reviewed-by: NDave Chinner <dchinner@redhat.com>
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      daba5427
    • E
      xfs: xfs_sb_read_verify() doesn't flag bad crcs on primary sb · 7a01e707
      Eric Sandeen 提交于
      My earlier commit 10e6e65d deserves a layer or two of brown paper
      bags.  The logic in that commit means that a CRC failure on the
      primary superblock will *never* result in an error return.
      
      Hopefully this fixes it, so that we always return the error
      if it's a primary superblock, otherwise only if the filesystem
      has CRCs enabled.
      Signed-off-by: NEric Sandeen <sandeen@redhat.com>
      Reviewed-by: NMark Tinguely <tinguely@sgi.com>
      Signed-off-by: NBen Myers <bpm@sgi.com>
      
      7a01e707
  2. 31 10月, 2013 2 次提交
    • E
      xfs: be more forgiving of a v4 secondary sb w/ junk in v5 fields · 10e6e65d
      Eric Sandeen 提交于
      Today, if xfs_sb_read_verify encounters a v4 superblock
      with junk past v4 fields which includes data in sb_crc,
      it will be treated as a failing checksum and a significant
      corruption.
      
      There are known prior bugs which leave junk at the end
      of the V4 superblock; we don't need to actually fail the
      verification in this case if other checks pan out ok.
      
      So if this is a secondary superblock, and the primary
      superblock doesn't indicate that this is a V5 filesystem,
      don't treat this as an actual checksum failure.
      
      We should probably check the garbage condition as
      we do in xfs_repair, and possibly warn about it
      or self-heal, but that's a different scope of work.
      
      Stable folks: This can go back to v3.10, which is what
      introduced the sb CRC checking that is tripped up by old,
      stale, incorrect V4 superblocks w/ unzeroed bits.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NEric Sandeen <sandeen@redhat.com>
      Acked-by: NDave Chinner <david@fromorbit.com>
      Reviewed-by: NMark Tinguely <tinguely@sgi.com>
      Signed-off-by: NBen Myers <bpm@sgi.com>
      10e6e65d
    • D
      xfs: fix static and extern sparse warnings · 632b89e8
      Dave Chinner 提交于
      The kbuild test robot indicated that there were some new sparse
      warnings in fs/xfs/xfs_dquot_buf.c. Actually, there were a lot more
      that is wasn't warning about, so fix them all up.
      
      Reported-by: kbuild test robot
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NBen Myers <bpm@sgi.com>
      Signed-off-by: NBen Myers <bpm@sgi.com>
      632b89e8
  3. 24 10月, 2013 3 次提交
    • D
      xfs: decouple inode and bmap btree header files · a4fbe6ab
      Dave Chinner 提交于
      Currently the xfs_inode.h header has a dependency on the definition
      of the BMAP btree records as the inode fork includes an array of
      xfs_bmbt_rec_host_t objects in it's definition.
      
      Move all the btree format definitions from xfs_btree.h,
      xfs_bmap_btree.h, xfs_alloc_btree.h and xfs_ialloc_btree.h to
      xfs_format.h to continue the process of centralising the on-disk
      format definitions. With this done, the xfs inode definitions are no
      longer dependent on btree header files.
      
      The enables a massive culling of unnecessary includes, with close to
      200 #include directives removed from the XFS kernel code base.
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NBen Myers <bpm@sgi.com>
      Signed-off-by: NBen Myers <bpm@sgi.com>
      a4fbe6ab
    • D
      xfs: decouple log and transaction headers · 239880ef
      Dave Chinner 提交于
      xfs_trans.h has a dependency on xfs_log.h for a couple of
      structures. Most code that does transactions doesn't need to know
      anything about the log, but this dependency means that they have to
      include xfs_log.h. Decouple the xfs_trans.h and xfs_log.h header
      files and clean up the includes to be in dependency order.
      
      In doing this, remove the direct include of xfs_trans_reserve.h from
      xfs_trans.h so that we remove the dependency between xfs_trans.h and
      xfs_mount.h. Hence the xfs_trans.h include can be moved to the
      indicate the actual dependencies other header files have on it.
      
      Note that these are kernel only header files, so this does not
      translate to any userspace changes at all.
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NBen Myers <bpm@sgi.com>
      Signed-off-by: NBen Myers <bpm@sgi.com>
      239880ef
    • D
      xfs: unify directory/attribute format definitions · 57062787
      Dave Chinner 提交于
      The on-disk format definitions for the directory and attribute
      structures are spread across 3 header files right now, only one of
      which is dedicated to defining on-disk structures and their
      manipulation (xfs_dir2_format.h). Pull all the format definitions
      into a single header file - xfs_da_format.h - and switch all the
      code over to point at that.
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NBen Myers <bpm@sgi.com>
      Signed-off-by: NBen Myers <bpm@sgi.com>
      57062787
  4. 18 10月, 2013 2 次提交
  5. 21 8月, 2013 1 次提交
  6. 13 8月, 2013 1 次提交
    • D
      xfs: introduce xfs_sb.c for sharing with libxfs · ff55068c
      Dave Chinner 提交于
      xfs_mount.c is shared with userspace, but the only functions that
      are shared are to do with physical superblock manipulations. This
      means that less than 25% of the xfs_mount.c code is actually shared
      with userspace. Move all the superblock functions to xfs_sb.c and
      share that instead with libxfs.
      
      Note that this will leave all the in-core transaction related
      superblock counter modifications in xfs_mount.c as none of that is
      shared with userspace. With a few more small changes, xfs_mount.h
      won't need to be shared with userspace anymore, either.
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NMark Tinguely <tinguely@sgi.com>
      Signed-off-by: NBen Myers <bpm@sgi.com>
      ff55068c