public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libdisk: use major/minor when calling dmsetup
@ 2009-09-11 17:33 Eric Sandeen
  2009-09-11 18:51 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Sandeen @ 2009-09-11 17:33 UTC (permalink / raw)
  To: xfs-oss

In RH bugzilla,
[Bug 471102] Error message seen during mkfs.xfs on multipath device
(unfortunately marked private) reports problems when making xfs
fileystems on multipath devices:

# mkfs -t xfs -f /dev/mpath/oramp4
dm_task_set_name: Device /dev/dm-12 not found
Command failed
dm_task_set_name: Device /dev/dm-12 not found
Command failed
meta-data=/dev/mpath/oramp4      isize=256    agcount=4, agsize=2359680 blks
...

This is because dmsetup takes a "name" which is sometimes, but not
always (I think) the same as the device name.

dmsetup also can take major/minor as arguments, so this may be
simpler at this point.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---


Index: xfsprogs-3.0.3/libdisk/dm.c
===================================================================
--- xfsprogs-3.0.3.orig/libdisk/dm.c
+++ xfsprogs-3.0.3/libdisk/dm.c
@@ -36,10 +36,11 @@ dm_get_subvol_stripe(
 {
 	int		count, stripes = 0, stripesize = 0;
 	int		dmpipe[2];
-	char		*dpath, *largv[4], tmppath[PATH_MAX];
+	char		*largv[7];
 	FILE		*stream;
 	long long	offset, size;
 	static char	*command = "table";	/* dmsetup table /dev/xxx */
+	char		major_str[4], minor_str[4];
 
 	if (!mnt_is_dm_subvol(sb->st_rdev))
 		return 0;
@@ -57,16 +58,15 @@ dm_get_subvol_stripe(
 		return 0;
 	}
 
-	if (!(dpath = realpath(dfile, tmppath))) {
-		fprintf(stderr,
-	_("Warning - device mapper device, but cannot resolve path %s: %s\n"),
-			dfile, strerror(errno));
-		return 0;
-	}
+	snprintf(major_str, 4, "%d", major(sb->st_rdev));
+	snprintf(minor_str, 4, "%d", minor(sb->st_rdev));
 
 	largv[1] = command;
-	largv[2] = dpath;
-	largv[3] = NULL;
+	largv[2] = "-j";
+	largv[3] = major_str;
+	largv[4] = "-m";
+	largv[5] = minor_str;
+	largv[6] = NULL;
 
 	/* Open pipe */
 	if (pipe(dmpipe) < 0) {

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libdisk: use major/minor when calling dmsetup
  2009-09-11 17:33 [PATCH] libdisk: use major/minor when calling dmsetup Eric Sandeen
@ 2009-09-11 18:51 ` Christoph Hellwig
  2009-09-11 19:00   ` Eric Sandeen
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2009-09-11 18:51 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs-oss

Looks good to me.  A library API to device mapper would be even better..

Reviewed-by: Christoph Hellwig <hch@lst.de>

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libdisk: use major/minor when calling dmsetup
  2009-09-11 18:51 ` Christoph Hellwig
@ 2009-09-11 19:00   ` Eric Sandeen
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Sandeen @ 2009-09-11 19:00 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs-oss

Christoph Hellwig wrote:
> Looks good to me.  A library API to device mapper would be even better..


But IIRC agk said that will never happen ;)

mkp's stuff will be even better when it's ready...

-Eric

> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> 

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-09-11 18:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-11 17:33 [PATCH] libdisk: use major/minor when calling dmsetup Eric Sandeen
2009-09-11 18:51 ` Christoph Hellwig
2009-09-11 19:00   ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox