Commit fcd2a434 authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: initialize the check_owner object fully

Initialize the check_owner list head so that we don't corrupt the list.
Reduce the scope of the object pointer.

Fixes: 858333dc ("xfs: check btree block ownership with bnobt/rmapbt when scrubbing btree")
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
parent 48ff4045
...@@ -408,7 +408,6 @@ xchk_btree_check_owner( ...@@ -408,7 +408,6 @@ xchk_btree_check_owner(
struct xfs_buf *bp) struct xfs_buf *bp)
{ {
struct xfs_btree_cur *cur = bs->cur; struct xfs_btree_cur *cur = bs->cur;
struct check_owner *co;
/* /*
* In theory, xfs_btree_get_block should only give us a null buffer * In theory, xfs_btree_get_block should only give us a null buffer
...@@ -431,10 +430,14 @@ xchk_btree_check_owner( ...@@ -431,10 +430,14 @@ xchk_btree_check_owner(
* later scanning. * later scanning.
*/ */
if (cur->bc_btnum == XFS_BTNUM_BNO || cur->bc_btnum == XFS_BTNUM_RMAP) { if (cur->bc_btnum == XFS_BTNUM_BNO || cur->bc_btnum == XFS_BTNUM_RMAP) {
struct check_owner *co;
co = kmem_alloc(sizeof(struct check_owner), co = kmem_alloc(sizeof(struct check_owner),
KM_MAYFAIL); KM_MAYFAIL);
if (!co) if (!co)
return -ENOMEM; return -ENOMEM;
INIT_LIST_HEAD(&co->list);
co->level = level; co->level = level;
co->daddr = xfs_buf_daddr(bp); co->daddr = xfs_buf_daddr(bp);
list_add_tail(&co->list, &bs->to_check); list_add_tail(&co->list, &bs->to_check);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment