Skip to content

Commit 6ac92fb

Browse files
Martijn Coenenaxboe
authored andcommitted
loop: Fix wrong masking of status flags
In faf1d25, loop_set_status() now assigns lo_status directly from the passed in lo_flags, but then fixes it up by masking out flags that can't be set by LOOP_SET_STATUS; unfortunately the mask was negated. Re-ran all ltp ioctl_loop tests, and they all passed. Pass run of the previously failing one: tst_test.c:1247: INFO: Timeout per run is 0h 05m 00s tst_device.c:88: INFO: Found free device 0 '/dev/loop0' ioctl_loop01.c:49: PASS: /sys/block/loop0/loop/partscan = 0 ioctl_loop01.c:50: PASS: /sys/block/loop0/loop/autoclear = 0 ioctl_loop01.c:51: PASS: /sys/block/loop0/loop/backing_file = '/tmp/ZRJ6H4/test.img' ioctl_loop01.c:65: PASS: get expected lo_flag 12 ioctl_loop01.c:67: PASS: /sys/block/loop0/loop/partscan = 1 ioctl_loop01.c:68: PASS: /sys/block/loop0/loop/autoclear = 1 ioctl_loop01.c:77: PASS: access /dev/loop0p1 succeeds ioctl_loop01.c:83: PASS: access /sys/block/loop0/loop0p1 succeeds Summary: passed 8 failed 0 skipped 0 warnings 0 Fixes: faf1d25 ("loop: Clean up LOOP_SET_STATUS lo_flags handling") Reported-by: Naresh Kamboju <[email protected]> Signed-off-by: Martijn Coenen <[email protected]> Tested-by: Naresh Kamboju <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent a75ca93 commit 6ac92fb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/block/loop.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,7 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
13901390
goto out_unfreeze;
13911391

13921392
/* Mask out flags that can't be set using LOOP_SET_STATUS. */
1393-
lo->lo_flags &= ~LOOP_SET_STATUS_SETTABLE_FLAGS;
1393+
lo->lo_flags &= LOOP_SET_STATUS_SETTABLE_FLAGS;
13941394
/* For those flags, use the previous values instead */
13951395
lo->lo_flags |= prev_lo_flags & ~LOOP_SET_STATUS_SETTABLE_FLAGS;
13961396
/* For flags that can't be cleared, use previous values too */

0 commit comments

Comments
 (0)