libndctl: ignore ENXIO in ndctl_namespace_delete
Vishal Verma
maintainerPATCH 1/1 libndctl: ignore ENXIO in ndctl_namespace_delete
The kernel will return ENXIO and fail attempts to set the size of a namespace that has already been deleted. When we are deleting a namespace, we don't care that it has been previously destroyed, or is in an uninitialized state.
Ignore the ENXIO from setting the size to zero in this case, and report to the callers of this API that the deletion was successful.
This addresses github issue #73.
--- ndctl/lib/libndctl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
ndctl/lib/libndctl.c +6 -1
@@ -4303,7 +4303,12 @@ NDCTL_EXPORT int ndctl_namespace_delete(struct ndctl_namespace *ndns) } rc =namespace_set_size (ndns,0 ); -if (rc) +/* +* if the namespace has already been deleted, this will return +* -ENXIO due to the uuid check in __size_store. We can safely +* ignore it in the case of writing a zero. +*/ +if (rc && (rc != -ENXIO ))return rc; region->namespaces_init =0 ;
Signature · 6 lines
2.17.2 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Quoted 6 lines · Vishal Verma
The kernel will return ENXIO and fail attempts to set the size of a namespace that has already been deleted. When we are deleting a namespace, we don't care that it has been previously destroyed, or is in an uninitialized state.
Quoted 6 lines
Ignore the ENXIO from setting the size to zero in this case, and report to the callers of this API that the deletion was successful.
This addresses github issue #73.
Signed-off-by Vishal Verma <[email protected]>
Looks good.
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm