Re: [PATCH] nvme: Do not detach nshead when a namespace is removed
From: Sagi Grimberg <sagi@grimberg.me>
Date: 2021-03-15 17:27:41
'struct nshead' and 'struct ns' have different lifetimes; the nshead can (and occasionally will) stay around even if no namespaces are connected, as it will only be finally removed once the last opener is gone. Once the system enters this state it becomes very hard to recover, as the only way to remove a namespace is to disconnect the controller, but the nshead is precisely _not_ related to a controller. This leads to the very annoying behaviour that a subsequent 'nvme connect' call will establish a _different_ nshead, _and_ the previous nshead will stay around:quoted
nvme list/dev/nvme0n1 9329c4c4af01db2c Linux \ 1 17.18 GB / 17.18 GB 4 KiB + 0 B 5.3.18-4quoted
nvme disconnect -d /dev/nvme0 nvme list/dev/nvme0n1 \ -1 0.00 B / 0.00 B 1 B + 0 B n1quoted
nvme connect nvme list/dev/nvme0n1 9329c4c4af01db2c Linux \ -1 0.00 B / 0.00 B 1 B + 0 B 5.3.18-4 /dev/nvme0n2 9329c4c4af01db2c Linux \ 1 17.18 GB / 17.18 GB 4 KiB + 0 B 5.3.18-4 This patch fixes the situation by only removing the nshead from the internal lists once it's being finally removed.
I'd say that we should remove the nshead exactly when the last lower ns was removed? Why should it still occupy sysfs and ida resources if it is going away soon? _______________________________________________ Linux-nvme mailing list Linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme