[PATCH] loopdev: set block_size when using LOOP_CONFIGURE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



LOOP_CONFIGURE ioctl was introduced by commit
d5fd456c88aba4fcf77d35fe38024a8d5c814686. Since the previous
implementation set partscan flag but did not set block_size with the
LOOP_CONFIGURE ioctl, an issue fixed by commit
422f0e9f206a145c59a71333dad20d38cbbfc0c4 was reappeared. Setting
block_size in the LOOP_CONFIGURE ioctl parameter fixes the issue.

Signed-off-by: Hideki EIRAKU <hdk@xxxxxxxxxx>
---
 lib/loopdev.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lib/loopdev.c b/lib/loopdev.c
index 437411bbe..631a120c4 100644
--- a/lib/loopdev.c
+++ b/lib/loopdev.c
@@ -1385,6 +1385,8 @@ int loopcxt_setup_device(struct loopdev_cxt *lc)
 	 * -- since Linux v5.8-rc1, commit 3448914e8cc550ba792d4ccc74471d1ca4293aae
 	 */
 	lc->config.fd = file_fd;
+	if (lc->blocksize > 0)
+		lc->config.block_size = lc->blocksize;
 
 	rc = repeat_on_eagain( ioctl(dev_fd, LOOP_CONFIGURE, &lc->config) );
 	if (rc != 0) {
@@ -1395,11 +1397,6 @@ int loopcxt_setup_device(struct loopdev_cxt *lc)
 		}
 		fallback = 1;
 	} else {
-		if (lc->blocksize > 0
-			&& (rc = loopcxt_ioctl_blocksize(lc, lc->blocksize)) < 0) {
-			errsv = -rc;
-			goto err;
-		}
 		DBG(SETUP, ul_debugobj(lc, "LOOP_CONFIGURE: OK"));
 	}
 
-- 
2.30.2




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux