Skip to content

Commit 3d3a51b

Browse files
djbwksacilotto
authored andcommitted
libnvdimm/namespace: Fix reaping of invalidated block-window-namespace labels
BugLink: https://bugs.launchpad.net/bugs/1910822 commit 2dd2a17 upstream. A recent change to ndctl to attempt to reconfigure namespaces in place uncovered a label accounting problem in block-window-type namespaces. The ndctl "create.sh" test is able to trigger this signature: WARNING: CPU: 34 PID: 9167 at drivers/nvdimm/label.c:1100 __blk_label_update+0x9a3/0xbc0 [libnvdimm] [..] RIP: 0010:__blk_label_update+0x9a3/0xbc0 [libnvdimm] [..] Call Trace: uuid_store+0x21b/0x2f0 [libnvdimm] kernfs_fop_write+0xcf/0x1c0 vfs_write+0xcc/0x380 ksys_write+0x68/0xe0 When allocated capacity for a namespace is renamed (new UUID) the labels with the old UUID need to be deleted. The ndctl behavior to always destroy namespaces on reconfiguration hid this problem. The immediate impact of this bug is limited since block-window-type namespaces only seem to exist in the specification and not in any shipping products. However, the label handling code is being reused for other technologies like CXL region labels, so there is a benefit to making sure both vertical labels sets (block-window) and horizontal label sets (pmem) have a functional reference implementation in libnvdimm. Fixes: c4703ce ("libnvdimm/namespace: Fix label tracking error") Cc: <[email protected]> Cc: Vishal Verma <[email protected]> Cc: Dave Jiang <[email protected]> Cc: Ira Weiny <[email protected]> Signed-off-by: Dan Williams <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Kamal Mostafa <[email protected]> Signed-off-by: Kelsey Skunberg <[email protected]>
1 parent d1ca320 commit 3d3a51b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/nvdimm/label.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,15 @@ static int __blk_label_update(struct nd_region *nd_region,
980980
}
981981
}
982982

983+
/* release slots associated with any invalidated UUIDs */
984+
mutex_lock(&nd_mapping->lock);
985+
list_for_each_entry_safe(label_ent, e, &nd_mapping->labels, list)
986+
if (test_and_clear_bit(ND_LABEL_REAP, &label_ent->flags)) {
987+
reap_victim(nd_mapping, label_ent);
988+
list_move(&label_ent->list, &list);
989+
}
990+
mutex_unlock(&nd_mapping->lock);
991+
983992
/*
984993
* Find the resource associated with the first label in the set
985994
* per the v1.2 namespace specification.

0 commit comments

Comments
 (0)