Subject: bug#21018: Support for "libnvdimm BLK" devices

From: Dan Williams <[email-masked]>
Date: Thu, 9 Jul 2015 10:00:10 -0700

BLK mode devices emitted by the libnvdimm sub-system [1] have a "." in
their name.  When parted calls _probe_sys_block() it trips over this
fact and unconditionally re-writes the block device name.

                /* in /sys/block, '/'s are replaced with '!' or '.' */
                for (ptr = dev_name; *ptr != '\0'; ptr++) {
                        if (*ptr == '!' || *ptr == '.')
                                *ptr = '/';
                }

This is confirmed by strace where parted emits calls to

lstat("/dev/ndblk2", 0x7ffec6b33e50)    = -1 ENOENT (No such file or directory)
stat("/dev/ndblk2/0", 0x7ffec6b33dc0)   = -1 ENOENT (No such file or directory)

The original BLK device name is /dev/ndblk2.0.

This can be reproduced with a 4.2-rc1+ kernel and the nfit_test
module.  See the libndctl readme for instructions on getting the test
environment running [2].

[1]: https://git.kernel.org/cgit/linux/kernel/git/djbw/nvdimm.git/tree/Documentation/nvdimm/nvdimm.txt?h=libnvdimm-for-next

[2]: https://github.com/pmem/ndctl