Skip to contentSkip to conversation

loop: don't clear LO_FLAGS_PARTSCAN on LOOP_SET_STATUS{,64}

PATCH Applied Christoph Hellwig 2 participants 2 messages Jan 27, 2025 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 loop: don't clear LO_FLAGS_PARTSCAN on LOOP_SET_STATUS{,64}

LOOP_SET_STATUS{,64} can set a lot more flags than it is supposed to clear (the LOOP_SET_STATUS_CLEARABLE_FLAGS vs LOOP_SET_STATUS_SETTABLE_FLAGS defines should have been a hint..).

Fix this by only clearing the bits in LOOP_SET_STATUS_CLEARABLE_FLAGS.

Fixes ae074d07a0e5 ("loop: move updating lo_flag s out of loop_set_status_from_info")
---
 drivers/block/loop.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/block/loop.c +1 -2
index 1ec7417c7f00..d1f1d6bef2e6 100644
@@ -1281,8 +1281,7 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
 	partscan = !(lo->lo_flags & LO_FLAGS_PARTSCAN) &&
 		(info->lo_flags & LO_FLAGS_PARTSCAN);
 
-	lo->lo_flags &= ~(LOOP_SET_STATUS_SETTABLE_FLAGS |
-			  LOOP_SET_STATUS_CLEARABLE_FLAGS);
+	lo->lo_flags &= ~LOOP_SET_STATUS_CLEARABLE_FLAGS;
 	lo->lo_flags |= (info->lo_flags & LOOP_SET_STATUS_SETTABLE_FLAGS);
 
 	if (size_changed) {
Signature · 1 line
2.45.2
maintainer Applied
#1 lore raw
Quoted 8 lines · Christoph Hellwig

LOOP_SET_STATUS{,64} can set a lot more flags than it is supposed to clear (the LOOP_SET_STATUS_CLEARABLE_FLAGS vs LOOP_SET_STATUS_SETTABLE_FLAGS defines should have been a hint..).

Fix this by only clearing the bits in LOOP_SET_STATUS_CLEARABLE_FLAGS.

[...]

Applied, thanks!

[1/1] loop: don't clear LO_FLAGS_PARTSCAN on LOOP_SET_STATUS{,64}

      commit: 5aa21b0495df1fac6d39f45011c1572bb431c44c

Best regards,

Signature · 1 line
Jens Axboe