Linux EXT4 FS development
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Samuel Smith <satlug@net153.net>
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu
Subject: Re: [PATCH] e2scrub: reorder exit status check after calling lvremove
Date: Sun, 6 Jul 2025 11:28:12 -0700	[thread overview]
Message-ID: <20250706182812.GB2672022@frogsfrogsfrogs> (raw)
In-Reply-To: <20250705033821.3695205-1-satlug@net153.net>

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

  reply	other threads:[~2025-07-06 18:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-05  3:38 [PATCH] e2scrub: reorder exit status check after calling lvremove Samuel Smith
2025-07-06 18:28 ` Darrick J. Wong [this message]
2025-07-09 16:48 ` Theodore Ts'o

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=20250706182812.GB2672022@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=satlug@net153.net \
    --cc=tytso@mit.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox