bug#21018: Support for "libnvdimm BLK" devices

Dan Williams <[email protected]>
Newsgroups gmane.comp.gnu.parted.bugs
Message-ID <CAPcyv4j0cqJq_Q+7U3dSS4n9RH6rVTkFsprXu_0nfegrQgMP+Q@mail.gmail.com>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.