summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dir2_format.h
diff options
context:
space:
mode:
authorDave Chinner2013-05-28 10:37:17 +0200
committerBen Myers2013-05-31 00:22:54 +0200
commite400d27d1690d609f203f2d7d8efebc98cbc3089 (patch)
tree6bb2cdbfb4e6d8ccb650d10e03683e291eeb6c10 /fs/xfs/xfs_dir2_format.h
parentxfs: disable swap extents ioctl on CRC enabled filesystems (diff)
downloadkernel-qcow2-linux-e400d27d1690d609f203f2d7d8efebc98cbc3089.tar.gz
kernel-qcow2-linux-e400d27d1690d609f203f2d7d8efebc98cbc3089.tar.xz
kernel-qcow2-linux-e400d27d1690d609f203f2d7d8efebc98cbc3089.zip
xfs: fix dir3 freespace block corruption
When the directory freespace index grows to a second block (2017 4k data blocks in the directory), the initialisation of the second new block header goes wrong. The write verifier fires a corruption error indicating that the block number in the header is zero. This was being tripped by xfs/110. The problem is that the initialisation of the new block is done just fine in xfs_dir3_free_get_buf(), but the caller then users a dirv2 structure to zero on-disk header fields that xfs_dir3_free_get_buf() has already zeroed. These lined up with the block number in the dir v3 header format. While looking at this, I noticed that the struct xfs_dir3_free_hdr() had 4 bytes of padding in it that wasn't defined as padding or being zeroed by the initialisation. Add a pad field declaration and fully zero the on disk and in-core headers in xfs_dir3_free_get_buf() so that this is never an issue in the future. Note that this doesn't change the on-disk layout, just makes the 32 bits of padding in the layout explicit. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Ben Myers <bpm@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com> (cherry picked from commit 5ae6e6a401957698f2bd8c9f4a86d86d02199fea)
Diffstat (limited to 'fs/xfs/xfs_dir2_format.h')
-rw-r--r--fs/xfs/xfs_dir2_format.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/xfs/xfs_dir2_format.h b/fs/xfs/xfs_dir2_format.h
index a3b1bd841a80..995f1f505a52 100644
--- a/fs/xfs/xfs_dir2_format.h
+++ b/fs/xfs/xfs_dir2_format.h
@@ -715,6 +715,7 @@ struct xfs_dir3_free_hdr {
__be32 firstdb; /* db of first entry */
__be32 nvalid; /* count of valid entries */
__be32 nused; /* count of used entries */
+ __be32 pad; /* 64 bit alignment. */
};
struct xfs_dir3_free {