Linux EXT4 FS development
 help / color / mirror / Atom feed
* [PATCH] e2scrub: reorder exit status check after calling lvremove
@ 2025-07-05  3:38 Samuel Smith
  2025-07-06 18:28 ` Darrick J. Wong
  2025-07-09 16:48 ` Theodore Ts'o
  0 siblings, 2 replies; 3+ messages in thread
From: Samuel Smith @ 2025-07-05  3:38 UTC (permalink / raw)
  To: linux-ext4; +Cc: tytso, Samuel Smith

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@net153.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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] e2scrub: reorder exit status check after calling lvremove
  2025-07-05  3:38 [PATCH] e2scrub: reorder exit status check after calling lvremove Samuel Smith
@ 2025-07-06 18:28 ` Darrick J. Wong
  2025-07-09 16:48 ` Theodore Ts'o
  1 sibling, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2025-07-06 18:28 UTC (permalink / raw)
  To: Samuel Smith; +Cc: linux-ext4, tytso

On Fri, Jul 04, 2025 at 10:38:21PM -0500, Samuel Smith wrote:
> 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@net153.net>

Yep, that was a mistake.  Sorry about that. :(
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  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
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] e2scrub: reorder exit status check after calling lvremove
  2025-07-05  3:38 [PATCH] e2scrub: reorder exit status check after calling lvremove Samuel Smith
  2025-07-06 18:28 ` Darrick J. Wong
@ 2025-07-09 16:48 ` Theodore Ts'o
  1 sibling, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2025-07-09 16:48 UTC (permalink / raw)
  To: linux-ext4, Samuel Smith; +Cc: Theodore Ts'o


On Fri, 04 Jul 2025 22:38:21 -0500, Samuel Smith wrote:
> Checking for snapshot device existence resets the status code in $?.
> Reording the conditions will allow the retry loop to work properly.
> 
> 

Applied, thanks!

[1/1] e2scrub: reorder exit status check after calling lvremove
      commit: fb9b2e7c9cf90e2c4eabcf1cffbde443e8eeb360

Best regards,
-- 
Theodore Ts'o <tytso@mit.edu>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-09 16:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-05  3:38 [PATCH] e2scrub: reorder exit status check after calling lvremove Samuel Smith
2025-07-06 18:28 ` Darrick J. Wong
2025-07-09 16:48 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox