1. 15 7月, 2014 1 次提交
    • D
      xfs: null unused quota inodes when quota is on · 03e01349
      Dave Chinner 提交于
      When quota is on, it is expected that unused quota inodes have a
      value of NULLFSINO. The changes to support a separate project quota
      in 3.12 broken this rule for non-project quota inode enabled
      filesystem, as the code now refuses to write the group quota inode
      if neither group or project quotas are enabled. This regression was
      introduced by commit d892d586 ("xfs: Start using pquotaino from the
      superblock").
      
      In this case, we should be writing NULLFSINO rather than nothing to
      ensure that we leave the group quota inode in a valid state while
      quotas are enabled.
      
      Failure to do so doesn't cause a current kernel to break - the
      separate project quota inodes introduced translation code to always
      treat a zero inode as NULLFSINO. This was introduced by commit
      01026297 ("xfs: Initialize all quota inodes to be NULLFSINO") with is
      also in 3.12 but older kernels do not do this and hence taking a
      filesystem back to an older kernel can result in quotas failing
      initialisation at mount time. When that happens, we see this in
      dmesg:
      
      [ 1649.215390] XFS (sdb): Mounting Filesystem
      [ 1649.316894] XFS (sdb): Failed to initialize disk quotas.
      [ 1649.316902] XFS (sdb): Ending clean mount
      
      By ensuring that we write NULLFSINO to quota inodes that aren't
      active, we avoid this problem. We have to be really careful when
      determining if the quota inodes are active or not, because we don't
      want to write a NULLFSINO if the quota inodes are active and we
      simply aren't updating them.
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NBrian Foster <bfoster@redhat.com>
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      03e01349
  2. 20 5月, 2014 2 次提交
  3. 05 5月, 2014 1 次提交
    • D
      xfs: fully support v5 format filesystems · c99d609a
      Dave Chinner 提交于
      We have had this code in the kernel for over a year now and have
      shaken all the known issues out of the code over the past few
      releases. It's now time to remove the experimental warnings during
      mount and fully support the new filesystem format in production
      systems.
      
      Remove the experimental warning, and add a version number to the
      initial "mounting filesystem" message to tell use what type of
      filesystem is being mounted. Also, remove the temporary inode
      cluster size output at mount time now we know that this code works
      fine.
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NBrian Foster <bfoster@redhat.com>
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      c99d609a
  4. 27 2月, 2014 4 次提交
  5. 19 2月, 2014 3 次提交
    • E
      xfs: limit superblock corruption errors to actual corruption · 5ef11eb0
      Eric Sandeen 提交于
      Today, if
      
      xfs_sb_read_verify
        xfs_sb_verify
          xfs_mount_validate_sb
      
      detects superblock corruption, it'll be extremely noisy, dumping
      2 stacks, 2 hexdumps, etc.
      
      This is because we call XFS_CORRUPTION_ERROR in xfs_mount_validate_sb
      as well as in xfs_sb_read_verify.
      
      Also, *any* errors in xfs_mount_validate_sb which are not corruption
      per se; things like too-big-blocksize, bad version, bad magic, v1 dirs,
      rw-incompat etc - things which do not return EFSCORRUPTED - will
      still do the whole XFS_CORRUPTION_ERROR spew when xfs_sb_read_verify
      sees any error at all.  And it suggests to the user that they
      should run xfs_repair, even if the root cause of the mount failure
      is a simple incompatibility.
      
      I'll submit that the probably-not-corrupted errors don't warrant
      this much noise, so this patch removes the warning for anything
      other than EFSCORRUPTED returns, and replaces the lower-level
      XFS_CORRUPTION_ERROR with an xfs_notice().
      Signed-off-by: NEric Sandeen <sandeen@redhat.com>
      Reviewed-by: NDave Chinner <dchinner@redhat.com>
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      5ef11eb0
    • 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
  6. 07 2月, 2014 1 次提交
    • E
      xfs: sanitize sb_inopblock in xfs_mount_validate_sb · 392c6de9
      Eric Sandeen 提交于
      xfs_mount_validate_sb doesn't check sb_inopblock for sanity
      (as does its xfs_repair counterpart, FWIW).
      
      If it's out of bounds, we can go off the rails in i.e.
      xfs_inode_buf_verify(), which uses sb_inopblock as a loop
      limit when stepping through a metadata buffer.
      
      The problem can be demonstrated easily by corrupting
      sb_inopblock with xfs_db and trying to mount the result:
      
      # mkfs.xfs -dfile,name=fsfile,size=1g
      # xfs_db -x fsfile
      xfs_db> sb 0
      xfs_db> write inopblock 512
      inopblock = 512
      xfs_db> quit
      
      # mount -o loop fsfile  mnt
      and we blow up in xfs_inode_buf_verify().
      
      With this patch, we get a (very noisy) corruption error,
      and fail the mount as we should.
      Signed-off-by: NEric Sandeen <sandeen@redhat.com>
      Reviewed-by: NJie Liu <jeff.liu@oracle.com>
      Reviewed-by: NBrian Foster <bfoster@redhat.com>
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      392c6de9
  7. 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
  8. 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
  9. 18 10月, 2013 2 次提交
  10. 21 8月, 2013 1 次提交
  11. 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