All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: master - tests: fsadm test continue after fs repair
Date: Fri, 23 Oct 2020 23:43:26 +0000 (GMT)	[thread overview]
Message-ID: <20201023234326.5ABCC384A881@sourceware.org> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=be94410446d381ab0512d347421a921c7966a10e
Commit:        be94410446d381ab0512d347421a921c7966a10e
Parent:        8c2779ba349e5ced3c9ea440929a6808ca443bf4
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Sat Oct 24 00:29:45 2020 +0200
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Sat Oct 24 01:42:16 2020 +0200

tests: fsadm test continue after fs repair

Test case where filesystem has been corrected via fsck.
In such case fsck returns '1' as success and should be
handled in a same way as '0' since fs is correct.
---
 test/shell/fsadm.sh | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/test/shell/fsadm.sh b/test/shell/fsadm.sh
index 8141da42c..3e7f9083c 100644
--- a/test/shell/fsadm.sh
+++ b/test/shell/fsadm.sh
@@ -61,7 +61,8 @@ cleanup_mounted_and_teardown()
 
 fscheck_ext3()
 {
-	fsck.ext3 -p -F -f "$dev_vg_lv"
+	# fsck with result code '1' is success
+	fsck.ext3 -p -F -f "$dev_vg_lv" || test "$?" -eq 1
 }
 
 fscheck_xfs()
@@ -113,6 +114,30 @@ if check_missing ext2; then
 	fscheck_ext3
 
 	lvresize -f -L20M $vg_lv
+
+	if which debugfs ; then
+		mkfs.ext2 -b4096 -j "$dev_vg_lv"
+		mount "$dev_vg_lv" "$mount_dir"
+		touch "$mount_dir/file"
+		umount "$mount_dir"
+		# generate a 'repariable' corruption
+		# so fsck returns code 1  (fs repaired)
+		debugfs -R "clri file" -w "$dev_vg_lv"
+
+		fsadm -v -f check "$dev_vg_lv"
+
+		# corrupting again
+		mount "$dev_vg_lv" "$mount_dir"
+		touch "$mount_dir/file"
+		umount "$mount_dir"
+		debugfs -R "clri file" -w "$dev_vg_lv"
+
+		mount "$dev_vg_lv" "$mount_dir"
+		fsadm -v -y --lvresize resize $vg_lv 10M
+		lvresize -L+10M -y -r -n $vg_lv
+		umount "$mount_dir" 2>/dev/null || true
+		fscheck_ext3
+	fi
 fi
 
 if check_missing ext3; then



                 reply	other threads:[~2020-10-23 23:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201023234326.5ABCC384A881@sourceware.org \
    --to=zkabelac@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.