public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Theodore Ts'o <tytso@mit.edu>
Cc: fstests@vger.kernel.org
Subject: Re: [PATCH 2/2] generic/563: create the loop dev with the same block size as the scratch dev
Date: Mon, 23 Oct 2023 08:54:47 -0700	[thread overview]
Message-ID: <20231023155447.GG11391@frogsfrogsfrogs> (raw)
In-Reply-To: <20231022215529.2202150-3-tytso@mit.edu>

On Sun, Oct 22, 2023 at 05:55:29PM -0400, Theodore Ts'o wrote:
> The generic/563 test creates the loop device using $SCRATCH_DEV
> directly.  We need to create the loop device with the same logical
> block size.  Otherwise, the loop device will always be created with
> the default logical block size of 512, and if its underlying backing
> store has a different logical block size, then mkfs may create a file
> system in the loop device that will fail to mount.
> 
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>

Looks fine to me,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  common/rc         | 10 ++++++++--
>  tests/generic/563 |  2 +-
>  2 files changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/common/rc b/common/rc
> index 8d7179567..01f065a9f 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -4246,9 +4246,15 @@ _require_userns()
>  
>  _create_loop_device()
>  {
> -	local file=$1 dev
> -	dev=`losetup -f --show $file` || _fail "Cannot assign $file to a loop device"
> +	local file=$1
> +	local blocksize=$2
> +	local dev
> +
> +	if [ -n "$blocksize" ]; then
> +		blocksize="-b $blocksize"
> +	fi
>  
> +	dev=`losetup -f $blocksize --show $file` || _fail "Cannot assign $file to a loop device"
>  	# Try to enable asynchronous directio mode on the loopback device so
>  	# that writeback started by a filesystem mounted on the loop device
>  	# won't be throttled by buffered writes to the lower filesystem.  This
> diff --git a/tests/generic/563 b/tests/generic/563
> index f98c6e42b..7e6bab49e 100755
> --- a/tests/generic/563
> +++ b/tests/generic/563
> @@ -89,7 +89,7 @@ reset()
>  
>  # cgroup I/O accounting doesn't work on partitions. Use a loop device to rule
>  # that out.
> -LOOP_DEV=$(_create_loop_device $SCRATCH_DEV)
> +LOOP_DEV=$(_create_loop_device $SCRATCH_DEV $(blockdev --getss $SCRATCH_DEV))
>  smajor=$((0x`stat -L -c %t $LOOP_DEV`))
>  sminor=$((0x`stat -L -c %T $LOOP_DEV`))
>  
> -- 
> 2.31.0
> 

      reply	other threads:[~2023-10-23 15:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-22 21:55 [PATCH 0/2] Fix test failures caused by storage devcies with 4k sectors Theodore Ts'o
2023-10-22 21:55 ` [PATCH 1/2] common: check if the scratch device can support 1024 block sizes Theodore Ts'o
2023-10-23 15:45   ` Darrick J. Wong
2023-10-23 19:48     ` Theodore Ts'o
2023-10-22 21:55 ` [PATCH 2/2] generic/563: create the loop dev with the same block size as the scratch dev Theodore Ts'o
2023-10-23 15:54   ` Darrick J. Wong [this message]

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=20231023155447.GG11391@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --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