Re: [PATCH] block: don't warn when calling fsync on read-only block devices
From: Jens Axboe <axboe@kernel.dk>
Date: 2018-09-05 22:14:13
On 9/3/18 4:05 PM, Mikulas Patocka wrote:
On Wed, 22 Aug 2018, Jens Axboe wrote:quoted
On 8/22/18 10:23 AM, Mikulas Patocka wrote:quoted
It is possible to call fsync on a read-only handle (for example, fsck.ext2 does it when doing read-only check), and this call results in kernel warning. This bug was introduced by the commit 721c7fc701c7 "block: fail op_is_write() requests to read-only partitions".Similar patch is already queued up, it'll go into Linus's tree before -rc1. -- Jens AxboeI think you mean the patch b089cfd95d32638335c551651a8e00fd2c4edb0b, but it doesn't work. The first problem is that bio_op returns the opcode, but op_is_flush expects flags as its parameter. bio_op strips off the flags, and so the condition op_is_flush is never true and the warning is not shut off. Anoher problem is that the flags REQ_FUA and REQ_PREFLUSH may be superimposed on regular write bio and in that case the warning should be triggered. We want to shut the warning off only if bio_sectors is zero (i.e. if the flush request is not superimposed on regular write).
Thanks for fixing that up, that was somewhat of a disaster. Applied. -- Jens Axboe