OSDN Git Service

nvme: fix visibility of "uuid" ns attribute
authorMartin Wilck <mwilck@suse.com>
Thu, 28 Sep 2017 19:33:23 +0000 (21:33 +0200)
committerJens Axboe <axboe@kernel.dk>
Sat, 11 Nov 2017 22:38:21 +0000 (15:38 -0700)
"uuid" must be invisible if both ns->uuid and ns->nguid are unset,
not if either one is.

Fixes: d934f9848a77 "nvme: provide UUID value to userspace"
Signed-off-by: Martin Wilck <mwilck@suse.com>
[hch: rebased to the nvme-4.15 tree to help resolving a conflict]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/host/core.c

index 7b3bbc1..993813c 100644 (file)
@@ -2525,7 +2525,7 @@ static umode_t nvme_ns_id_attrs_are_visible(struct kobject *kobj,
        struct nvme_ns_ids *ids = &dev_to_ns_head(dev)->ids;
 
        if (a == &dev_attr_uuid.attr) {
-               if (uuid_is_null(&ids->uuid) ||
+               if (uuid_is_null(&ids->uuid) &&
                    !memchr_inv(ids->nguid, 0, sizeof(ids->nguid)))
                        return 0;
        }