[PATCH] nvme: forward port sysfs delete fix
Keith Busch
kbusch at meta.com
Thu Jun 15 08:23:18 PDT 2023
From: Keith Busch <kbusch at kernel.org>
We had a late fix that modified nvme_sysfs_delete() after the staging
branch for the next merge window relocated the function to a new file.
Port commit 2eb94dd56a4a4 ("nvme: do not let the user delete a ctrl
before a complete") to the latest to avoid a potentially confusing merge
conflict.
Cc: Maurizio Lombardi <mlombard at redhat.com>
Cc: Max Gurtovoy <mgurtovoy at nvidia.com>
Signed-off-by: Keith Busch <kbusch at kernel.org>
---
drivers/nvme/host/sysfs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/nvme/host/sysfs.c b/drivers/nvme/host/sysfs.c
index 796e1d373b7c1..45e91811f905c 100644
--- a/drivers/nvme/host/sysfs.c
+++ b/drivers/nvme/host/sysfs.c
@@ -202,6 +202,9 @@ static ssize_t nvme_sysfs_delete(struct device *dev,
{
struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
+ if (!test_bit(NVME_CTRL_STARTED_ONCE, &ctrl->flags))
+ return -EBUSY;
+
if (device_remove_file_self(dev, attr))
nvme_delete_ctrl_sync(ctrl);
return count;
--
2.34.1
More information about the Linux-nvme
mailing list