]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
block: Correctly initialize BLK_INTEGRITY_NOGENERATE and BLK_INTEGRITY_NOVERIFY
authorAnuj Gupta <anuj20.g@samsung.com>
Wed, 5 Mar 2025 06:30:33 +0000 (12:00 +0530)
committerJens Axboe <axboe@kernel.dk>
Thu, 6 Mar 2025 15:01:37 +0000 (08:01 -0700)
Currently, BLK_INTEGRITY_NOGENERATE and BLK_INTEGRITY_NOVERIFY are not
explicitly set during integrity initialization. This can lead to
incorrect reporting of read_verify and write_generate sysfs values,
particularly when a device does not support integrity. Ensure that these
flags are correctly initialized by default.

Reported-by: M Nikhil <nikh1092@linux.ibm.com>
Link: https://lore.kernel.org/linux-block/f6130475-3ccd-45d2-abde-3ccceada0f0a@linux.ibm.com/
Fixes: 9f4aa46f2a74 ("block: invert the BLK_INTEGRITY_{GENERATE,VERIFY} flags")
Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20250305063033.1813-3-anuj20.g@samsung.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-settings.c

index 25fd7793fd9da6b166ef72b0d0d4ef5a8983e344..008947a135411e54652169dbacb3bcf346350a6a 100644 (file)
@@ -114,6 +114,7 @@ static int blk_validate_integrity_limits(struct queue_limits *lim)
                        pr_warn("invalid PI settings.\n");
                        return -EINVAL;
                }
+               bi->flags |= BLK_INTEGRITY_NOGENERATE | BLK_INTEGRITY_NOVERIFY;
                return 0;
        }