Skip to content

Commit 11487dd

Browse files
Christoph Hellwigtrondmypd
authored andcommitted
nfs/blocklayout: support RH/Fedora dm-mpath device nodes
Instead of reusing the wwn-* names for multipath devices nodes RHEL and Fedora introduce new dm-mpath-uuid-* nodes with a slightly different naming scheme. Try these names first to ensure we always get a multipath-capable device if it exists. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
1 parent d702d41 commit 11487dd

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

‎fs/nfs/blocklayout/dev.c‎

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,28 @@ bl_open_udev_path(struct pnfs_block_volume *v)
312312
return bdev;
313313
}
314314

315+
/*
316+
* Try to open the RH/Fedora specific dm-mpath udev path for this WWN, as the
317+
* wwn- links will only point to the first discovered SCSI device there.
318+
*/
319+
static struct block_device *
320+
bl_open_dm_mpath_udev_path(struct pnfs_block_volume *v)
321+
{
322+
struct block_device *bdev;
323+
const char *devname;
324+
325+
devname = kasprintf(GFP_KERNEL,
326+
"/dev/disk/by-id/dm-uuid-mpath-%d%*phN",
327+
v->scsi.designator_type,
328+
v->scsi.designator_len, v->scsi.designator);
329+
if (!devname)
330+
return ERR_PTR(-ENOMEM);
331+
332+
bdev = blkdev_get_by_path(devname, FMODE_READ | FMODE_WRITE, NULL);
333+
kfree(devname);
334+
return bdev;
335+
}
336+
315337
static int
316338
bl_parse_scsi(struct nfs_server *server, struct pnfs_block_dev *d,
317339
struct pnfs_block_volume *volumes, int idx, gfp_t gfp_mask)
@@ -323,7 +345,9 @@ bl_parse_scsi(struct nfs_server *server, struct pnfs_block_dev *d,
323345
if (!bl_validate_designator(v))
324346
return -EINVAL;
325347

326-
d->bdev = bl_open_udev_path(v);
348+
d->bdev = bl_open_dm_mpath_udev_path(v);
349+
if (IS_ERR(d->bdev))
350+
d->bdev = bl_open_udev_path(v);
327351
if (IS_ERR(d->bdev))
328352
return PTR_ERR(d->bdev);
329353

0 commit comments

Comments
 (0)