-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
xfs: add a test for v1 inodes with nonzero nlink and onlink fields
Add a regression test for XFS V1 inodes that have both nlink and onlink fields set to 1. Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Zorro Lang <[email protected]>
- Loading branch information
Darrick J. Wong
authored and
Zorro Lang
committed
Aug 23, 2024
1 parent
5381898
commit d77a998
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#! /bin/bash | ||
# SPDX-License-Identifier: GPL-2.0 | ||
# Copyright (c) 2024 Oracle. All Rights Reserved. | ||
# | ||
# FS QA Test No. 608 | ||
# | ||
# Regression test for V1 inodes that have di_onlink and di_nlink set to 1. | ||
# | ||
. ./common/preamble | ||
_begin_fstest auto | ||
|
||
_fixed_by_kernel_commit XXXXXXXXXXXX \ | ||
"xfs: fix di_onlink checking for V1/V2 inodes", | ||
|
||
_require_scratch_nocheck # we'll do our own checking | ||
_require_xfs_nocrc | ||
|
||
_scratch_mkfs -m crc=0 >> $seqres.full | ||
_scratch_xfs_db -x \ | ||
-c 'sb' \ | ||
-c 'addr rbmino' \ | ||
-c 'print core.nlinkv2 core.onlink' \ | ||
-c 'write -d core.version 1' \ | ||
-c 'write -d core.nlinkv1 1' \ | ||
-c 'print core.version core.nlinkv1' | ||
|
||
# repair doesn't flag this combination | ||
_scratch_xfs_repair -n &>> $seqres.full || echo "xfs_repair -n failed??" | ||
|
||
# Prior to kernel commit 40cb8613d612 ("xfs: check unused nlink fields in the | ||
# ondisk inode"), the kernel accepted V1 format inode where both the new and | ||
# old nlink fields are set to 1. With that commit applied, it stopped | ||
# accepting that combination and will refuse to mount. Hence we need the fix | ||
# mentioned above. | ||
_scratch_mount | ||
|
||
# success, all done | ||
status=0 | ||
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
QA output created by 608 | ||
core.nlinkv2 = 1 | ||
core.onlink = 0 | ||
core.version = 1 | ||
core.nlinkv1 = 1 | ||
core.version = 1 | ||
core.nlinkv1 = 1 |