diff options
author | Eric Sandeen <sandeen@redhat.com> | 2017-01-09 10:38:58 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-01-12 05:39:44 -0500 |
commit | 3c382dda47e4b51de6d67847ddfc9c10962c4ca3 (patch) | |
tree | 069ef59a0aadb11c67efe700d50fa1b97ba3b993 /fs | |
parent | c00203386d50c1d2f2621163b9d7a533de4819fc (diff) |
xfs: ignore leaf attr ichdr.count in verifier during log replay
commit 2e1d23370e75d7d89350d41b4ab58c7f6a0e26b2 upstream.
When we create a new attribute, we first create a shortform
attribute, and try to fit the new attribute into it.
If that fails, we copy the (empty) attribute into a leaf attribute,
and do the copy again. Thus there can be a transient state where
we have an empty leaf attribute.
If we encounter this during log replay, the verifier will fail.
So add a test to ignore this part of the leaf attr verification
during log replay.
Thanks as usual to dchinner for spotting the problem.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/libxfs/xfs_attr_leaf.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c index 8ea91f363093..2852521fc8ec 100644 --- a/fs/xfs/libxfs/xfs_attr_leaf.c +++ b/fs/xfs/libxfs/xfs_attr_leaf.c | |||
@@ -253,6 +253,7 @@ xfs_attr3_leaf_verify( | |||
253 | { | 253 | { |
254 | struct xfs_mount *mp = bp->b_target->bt_mount; | 254 | struct xfs_mount *mp = bp->b_target->bt_mount; |
255 | struct xfs_attr_leafblock *leaf = bp->b_addr; | 255 | struct xfs_attr_leafblock *leaf = bp->b_addr; |
256 | struct xfs_perag *pag = bp->b_pag; | ||
256 | struct xfs_attr3_icleaf_hdr ichdr; | 257 | struct xfs_attr3_icleaf_hdr ichdr; |
257 | 258 | ||
258 | xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, leaf); | 259 | xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, leaf); |
@@ -273,7 +274,12 @@ xfs_attr3_leaf_verify( | |||
273 | if (ichdr.magic != XFS_ATTR_LEAF_MAGIC) | 274 | if (ichdr.magic != XFS_ATTR_LEAF_MAGIC) |
274 | return false; | 275 | return false; |
275 | } | 276 | } |
276 | if (ichdr.count == 0) | 277 | /* |
278 | * In recovery there is a transient state where count == 0 is valid | ||
279 | * because we may have transitioned an empty shortform attr to a leaf | ||
280 | * if the attr didn't fit in shortform. | ||
281 | */ | ||
282 | if (pag && pag->pagf_init && ichdr.count == 0) | ||
277 | return false; | 283 | return false; |
278 | 284 | ||
279 | /* XXX: need to range check rest of attr header values */ | 285 | /* XXX: need to range check rest of attr header values */ |