From: Sagi Grimberg <sagi@grimberg.me>
To: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
Li Feng <fengli@smartx.com>,
"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@fb.com>,
Christoph Hellwig <hch@lst.de>,
"open list:NVM EXPRESS DRIVER" <linux-nvme@lists.infradead.org>,
open list <linux-kernel@vger.kernel.org>
Cc: "lifeng1519@gmail.com" <lifeng1519@gmail.com>
Subject: Re: [PATCH] nvme: reject the ns when the block size is smaller than a sector
Date: Wed, 13 Jan 2021 14:12:59 -0800 [thread overview]
Message-ID: <87698545-de26-c0ca-01e9-4dc2ddcacc80@grimberg.me> (raw)
In-Reply-To: <SN4PR0401MB35985C08E5FFCDF0F5817A9D9BA90@SN4PR0401MB3598.namprd04.prod.outlook.com>
>> The nvme spec(1.4a, figure 248) says:
>> "A value smaller than 9 (i.e., 512 bytes) is not supported."
>>
>> Signed-off-by: Li Feng <fengli@smartx.com>
>> ---
>> drivers/nvme/host/core.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
>> index f320273fc672..1f02e6e49a05 100644
>> --- a/drivers/nvme/host/core.c
>> +++ b/drivers/nvme/host/core.c
>> @@ -2161,6 +2161,12 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id)
>>
>> blk_mq_freeze_queue(ns->disk->queue);
>> ns->lba_shift = id->lbaf[lbaf].ds;
>> + if (ns->lba_shift < 9) {
>> + pr_warn("%s: bad lba_shift(%d)\n", ns->disk->disk_name, ns->lba_shift);
>> + ret = -1;
Meaningful errno would be useful. Also better to use dev_warn
>> + goto out_unfreeze;
>> + }
>> +
>> nvme_set_queue_limits(ns->ctrl, ns->queue);
>>
>> if (ns->head->ids.csi == NVME_CSI_ZNS) {
>>
>
>
> But this only catches a physical block size < 512 for NVMe, not any other block device.
>
> Please fix it for the general case in blk_queue_physical_block_size().
We actually call that later and would probably be better to check here..
next prev parent reply other threads:[~2021-01-13 22:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-13 16:06 Li Feng
2021-01-13 16:18 ` Johannes Thumshirn
2021-01-13 22:12 ` Sagi Grimberg [this message]
2021-01-14 5:17 ` Feng Li
2021-01-14 17:43 ` Christoph Hellwig
2021-01-14 21:13 ` Sagi Grimberg
2021-01-15 3:30 ` Li Feng
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=87698545-de26-c0ca-01e9-4dc2ddcacc80@grimberg.me \
--to=sagi@grimberg.me \
--cc=Johannes.Thumshirn@wdc.com \
--cc=axboe@fb.com \
--cc=fengli@smartx.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=lifeng1519@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=martin.petersen@oracle.com \
/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®