mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Ilya Dryomov <idryomov@gmail.com>
Cc: stefan@agner.ch, Sagi Grimberg <sagi@grimberg.me>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Warning when using eMMC and partprobe: generic_make_request: Trying to write to read-only block-device
Date: Tue, 14 Aug 2018 10:24:47 -0600	[thread overview]
Message-ID: <22fff85b-63e5-3cfe-0e72-255044e53bab@kernel.dk> (raw)
In-Reply-To: <CA+55aFwyCmYfUrGt61d-6B=1XiTLoudNO=_bQ9-g_rDg8Ao_VA@mail.gmail.com>

On 8/14/18 10:22 AM, Linus Torvalds wrote:
> On Tue, Aug 14, 2018 at 8:24 AM Ilya Dryomov <idryomov@gmail.com> wrote:
>>
>> Looks like it's coming from that fsync():
>>
>>   sys_fsync
>>     do_fsync
>>       vfs_fsync_range
>>         blkdev_fsync
>>           blkdev_issue_flush
>>
>> I think we need to teach blkdev_issue_flush() to bail out if the bdev
>> is read-only, similar to blkdev_issue_discard(), _write_zeroes(), etc.
>> The question is which error code to use.  blkdev_fsync() already skips
>> over EOPNOTSUPP, so it is a (no-so-good) option.  Other blkdev_issue_
>> functions return EPERM.
> 
> Oh, just make issue_flush() return EROFS for a read-only device.
> 
> Or maybe we should even just consider the flush to be a read operation?
> 
> But I guess the error code gets percolated all the way to user space?
> The safest option might just be to return 0.

We probably just want to special case a flush for this check. In other
situations, like resource allocation and issue, we'd want to consider
it a write.

-- 
Jens Axboe


  reply	other threads:[~2018-08-14 16:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-14 14:41 Stefan Agner
2018-08-14 15:24 ` Ilya Dryomov
2018-08-14 16:22   ` Linus Torvalds
2018-08-14 16:24     ` Jens Axboe [this message]
2018-08-14 16:26       ` Jens Axboe
2018-08-14 16:51         ` Linus Torvalds
2018-08-14 16:52           ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=22fff85b-63e5-3cfe-0e72-255044e53bab@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=idryomov@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sagi@grimberg.me \
    --cc=stefan@agner.ch \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®