Message ID | 20170128104726.GA4757@giis.co.in (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
> > apply anymore, but I'm expecting some more changes to it so please adapt > it to the new file Not sure what went wrong, will test the next patch with git apply and send it. > > I prefer 'inode_number' or simple 'ino' for the variable name. > Okay, will use inode_number. > >+ > >+ $SUDO_HELPER $TOP/btrfs check $TEST_DEV &>> $RESULTS && \ > >+ _fail "btrfs check failed to detect nlink corruption" > >+ run_check $SUDO_HELPER $TOP/btrfs check --repair $TEST_DEV > >+ run_check $SUDO_HELPER $TOP/btrfs check $TEST_DEV > > What about using check_image() here? I didn't know about check_image(), looks like above 3 lines can be replaced with check_image. Will make the change. > > Thanks, > Qu > Cheers. Lakshmipathi.G -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/tests/fsck-tests/026-check-inode-link/test.sh b/tests/fsck-tests/026-check-inode-link/test.sh new file mode 100755 index 0000000..9e75ef4 --- /dev/null +++ b/tests/fsck-tests/026-check-inode-link/test.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +source $TOP/tests/common + +check_prereq btrfs-corrupt-block +check_prereq mkfs.btrfs +check_prereq btrfs + +setup_root_helper +prepare_test_dev 512M + +# verify that 'btrfs check --repair' fixes corrupted inode nlink field. +test_inode_nlink_field() +{ + run_check $SUDO_HELPER $TOP/mkfs.btrfs -f $TEST_DEV + + run_check_mount_test_dev + run_check $SUDO_HELPER touch $TEST_MNT/test_nlink.txt + + # find inode_item id + inode_item=`stat -c%i $TEST_MNT/test_nlink.txt` + run_check_umount_test_dev + + # corrupt nlink field of inode object + run_check $SUDO_HELPER $TOP/btrfs-corrupt-block -i $inode_item \ + -f nlink $TEST_DEV + + $SUDO_HELPER $TOP/btrfs check $TEST_DEV &>> $RESULTS && \ + _fail "btrfs check failed to detect nlink corruption" + run_check $SUDO_HELPER $TOP/btrfs check --repair $TEST_DEV + run_check $SUDO_HELPER $TOP/btrfs check $TEST_DEV +} + +test_inode_nlink_field
Signed-off-by: Lakshmipathi.G <Lakshmipathi.G@giis.co.in> --- tests/fsck-tests/026-check-inode-link/test.sh | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 tests/fsck-tests/026-check-inode-link/test.sh