Skip to content

Commit b089cfd

Browse files
committed
block: don't warn for flush on read-only device
Don't warn for a flush issued to a read-only device. It's not strictly a writable command, as it doesn't change any on-media data by itself. Reported-by: Stefan Agner <stefan@agner.ch> Fixes: 721c7fc ("block: fail op_is_write() requests to read-only partitions") Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent eb2b3d0 commit b089cfd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

block/blk-core.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2162,7 +2162,9 @@ static inline bool should_fail_request(struct hd_struct *part,
21622162

21632163
static inline bool bio_check_ro(struct bio *bio, struct hd_struct *part)
21642164
{
2165-
if (part->policy && op_is_write(bio_op(bio))) {
2165+
const int op = bio_op(bio);
2166+
2167+
if (part->policy && (op_is_write(op) && !op_is_flush(op))) {
21662168
char b[BDEVNAME_SIZE];
21672169

21682170
printk(KERN_ERR

0 commit comments

Comments
 (0)