lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250705033821.3695205-1-satlug@net153.net>
Date: Fri,  4 Jul 2025 22:38:21 -0500
From: Samuel Smith <satlug@...153.net>
To: linux-ext4@...r.kernel.org
Cc: tytso@....edu,
	Samuel Smith <satlug@...153.net>
Subject: [PATCH] e2scrub: reorder exit status check after calling lvremove

Checking for snapshot device existence resets the status code in $?.
Reording the conditions will allow the retry loop to work properly.

Signed-off-by: Samuel Smith <satlug@...153.net>
---
 scrub/e2scrub.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scrub/e2scrub.in b/scrub/e2scrub.in
index 043bc12b..6f9b5ce2 100644
--- a/scrub/e2scrub.in
+++ b/scrub/e2scrub.in
@@ -182,7 +182,7 @@ snap_dev="/dev/${LVM2_VG_NAME}/${snap}"
 teardown() {
 	# Remove and wait for removal to succeed.
 	${DBG} lvremove -f "${LVM2_VG_NAME}/${snap}"
-	while [ -e "${snap_dev}" ] && [ "$?" -eq "5" ]; do
+	while [ "$?" -eq "5" ] && [ -e "${snap_dev}" ]; do
 		sleep 0.5
 		${DBG} lvremove -f "${LVM2_VG_NAME}/${snap}"
 	done
@@ -210,7 +210,7 @@ setup() {
 	# Try to remove snapshot for 30s, bail out if we can't remove it.
 	lvremove_deadline="$(( $(date "+%s") + 30))"
 	${DBG} lvremove -f "${LVM2_VG_NAME}/${snap}" 2>/dev/null
-	while [ -e "${snap_dev}" ] && [ "$?" -eq "5" ] &&
+	while [ "$?" -eq "5" ] && [ -e "${snap_dev}" ] &&
 	      [ "$(date "+%s")" -lt "${lvremove_deadline}" ]; do
 		sleep 0.5
 		${DBG} lvremove -f "${LVM2_VG_NAME}/${snap}"
-- 
2.39.5


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ