nvme: Mark external NVMe devices as removable
PATCH 1/1 nvme: Mark external NVMe devices as removable
Commit c037b6c818c3 ("PCI: Add sysfs "removable" attribute") can mark entire Thunderbolt hierarchy as removable, if system firmware provides correct attribute.
So apply GENHD_FL_REMOVABLE for NVMe if removable bit is set, to make userspace daemon like Udisks knows it can be automount.
--- drivers/nvme/host/core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/nvme/host/core.c +3 -0
@@ -3851,6 +3851,9 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid, ns->disk = disk; ns->queue = disk->queue; +if (dev_is_removable (ctrl->dev)) + ns->disk->flags |=GENHD_FL_REMOVABLE ; +if (ctrl->opts && ctrl->opts->data_digest)blk_queue_flag_set (QUEUE_FLAG_STABLE_WRITES , ns->queue);
Signature · 1 line
2.33.1
Christoph Hellwig
maintainerQuoted 6 lines · Kai-Heng Feng
Commit
c037b6c818c3("PCI: Add sysfs "removable" attribute") can mark entire Thunderbolt hierarchy as removable, if system firmware provides correct attribute.So apply
GENHD_FL_REMOVABLEfor NVMe if removable bit is set, to make userspace daemon like Udisks knows it can be automount.
GENHD_FL_REMOVABLE means removable media as in floppies or CD-ROMs, which does not apply to NVMe at all.
Quoted 11 lines · Christoph Hellwig
Quoted 6 lines · Kai-Heng Feng
Commit
c037b6c818c3("PCI: Add sysfs "removable" attribute") can mark entire Thunderbolt hierarchy as removable, if system firmware provides correct attribute.So apply
GENHD_FL_REMOVABLEfor NVMe if removable bit is set, to make userspace daemon like Udisks knows it can be automount.
GENHD_FL_REMOVABLEmeans removable media as in floppies or CD-ROMs, which does not apply to NVMe at all.
USB thumb drives also use this flag, so I am not sure why it's not applicable to NVMe?
Kai-Heng
Christoph Hellwig
maintainerQuoted 2 lines · Kai-Heng Feng
USB thumb drives also use this flag, so I am not sure why it's not applicable to NVMe?
They shouldn't report this flag and might need fixing.
Quoted 6 lines · Christoph Hellwig
Quoted 2 lines · Kai-Heng Feng
USB thumb drives also use this flag, so I am not sure why it's not applicable to NVMe?
They shouldn't report this flag and might need fixing.
So what should we do? Introduce a different flag but with identical usage for external USB and NVMe storages?
Kai-Heng
Keith Busch
maintainerQuoted 10 lines · Kai-Heng Feng
Quoted 6 lines · Christoph Hellwig
Quoted 2 lines · Kai-Heng Feng
USB thumb drives also use this flag, so I am not sure why it's not applicable to NVMe?
They shouldn't report this flag and might need fixing.
So what should we do? Introduce a different flag but with identical usage for external USB and NVMe storages?
What's the user visible result with this flag set? Does some rule automatically mount a 'removable' block device's filesystem partitions to something like /media/?
Quoted 8 lines · Keith Busch
Quoted 6 lines · Kai-Heng Feng
Quoted 5 lines · Christoph Hellwig
Quoted 2 lines · Kai-Heng Feng
USB thumb drives also use this flag, so I am not sure why it's not applicable to NVMe?
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
They shouldn't report this flag and might need fixing.
So what should we do? Introduce a different flag but with identical usage for external USB and NVMe storages?
What's the user visible result with this flag set? Does some rule automatically mount a 'removable' block device's filesystem partitions to something like /media/?
Udisks uses 'removable' to flag its 'HintAuto' attribute, and GNOME Shell will automount the disk based on 'HintAuto'.
Kai-Heng