From: Christoph Hellwig <hch@lst.de>
To: me@kingtous.cn
Cc: Christoph Hellwig <hch@lst.de>,
kbusch@kernel.org, linux-nvme@lists.infradead.org, axboe@fb.com,
sagi@grimberg.me, kingtous <kingtous@qq.com>
Subject: Re: [PATCH] fix: nvme_update_ns_info method should be called even if nvme_ms_ids_equal return false
Date: Fri, 8 Apr 2022 08:22:10 +0200 [thread overview]
Message-ID: <20220408062210.GA410@lst.de> (raw)
In-Reply-To: <ABwAxgCYBwe5Iq2fM1-8qqrc.3.1649398333597.Hmail.me@kingtous.cn>
On Fri, Apr 08, 2022 at 02:12:13PM +0800, me@kingtous.cn wrote:
> Yes, I only have one controller with one namespace.
> I've done `nvme id-ns /dev/nvme0n1` times before and after suspend. The only difference between the two output is nuse address. The nuse address's output is dynamic, the outputs are different each time I execute the nvme id-ns command.
> When the laptop wakes up, tty will show "identifiers changed for nsid 1". I checked the "nvme_ns_ids_equal" function, it will check uuid, nguid, eui64 and csi. So maybe there is something changed in uuid or csi?
Let's try this:
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index efb85c6d8e2d5..0c38184a3ffa2 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1631,10 +1631,28 @@ static void nvme_config_discard(struct gendisk *disk, struct nvme_ns *ns)
static bool nvme_ns_ids_equal(struct nvme_ns_ids *a, struct nvme_ns_ids *b)
{
- return uuid_equal(&a->uuid, &b->uuid) &&
- memcmp(&a->nguid, &b->nguid, sizeof(a->nguid)) == 0 &&
- memcmp(&a->eui64, &b->eui64, sizeof(a->eui64)) == 0 &&
- a->csi == b->csi;
+ if (uuid_equal(&a->uuid, &b->uuid)) {
+ printk("uuid changed from %pU to %pU\n",
+ &a->uuid, &b->uuid);
+ return false;
+ }
+ if (memcmp(&a->nguid, &b->nguid, sizeof(a->nguid))) {
+ printk("nguid changed from %16phN to %16phN\n",
+ &a->nguid, &b->nguid);
+ return false;
+ }
+ if (memcmp(&a->eui64, &b->eui64, sizeof(a->eui64))) {
+ printk("eui changed from %8phN to %8phN\n",
+ &a->eui64, &b->eui64);
+ return false;
+ }
+ if (a->csi != b->csi) {
+ printk("csi changed from %u to %u\n",
+ a->csi, b->csi);
+ return false;
+ }
+
+ return true;
}
static int nvme_init_ms(struct nvme_ns *ns, struct nvme_id_ns *id)
next prev parent reply other threads:[~2022-04-08 6:22 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-08 2:57 [PATCH] fix: nvme_update_ns_info method should be called even if nvme_ms_ids_equal return false me
2022-04-08 5:19 ` Christoph Hellwig
[not found] ` <ABwAxgCYBwe5Iq2fM1-8qqrc.3.1649398333597.Hmail.me@kingtous.cn>
2022-04-08 6:22 ` Christoph Hellwig [this message]
2022-04-08 7:56 ` 金韬
2022-04-08 8:07 ` Christoph Hellwig
2022-04-08 8:35 ` 金韬
2022-04-08 15:18 ` Keith Busch
2022-04-08 16:04 ` Christoph Hellwig
2022-04-09 0:58 ` Tao Jin
2022-04-09 4:43 ` Christoph Hellwig
2022-04-09 9:11 ` Tao Jin
2022-04-11 5:49 ` Christoph Hellwig
2022-04-11 5:56 ` 金韬
2022-04-11 6:07 ` Christoph Hellwig
2022-04-11 14:20 ` 金韬
2022-04-12 5:04 ` Christoph Hellwig
2022-04-12 6:34 ` 金韬
2022-05-23 18:18 ` Arman Hajishafieha
2022-05-24 13:50 ` hch
2022-05-24 16:51 ` Arman Hajishafieha
2022-05-24 20:54 ` Chaitanya Kulkarni
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=20220408062210.GA410@lst.de \
--to=hch@lst.de \
--cc=axboe@fb.com \
--cc=kbusch@kernel.org \
--cc=kingtous@qq.com \
--cc=linux-nvme@lists.infradead.org \
--cc=me@kingtous.cn \
--cc=sagi@grimberg.me \
/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