public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: xfs-oss <xfs@oss.sgi.com>
Subject: [PATCH] libdisk: use major/minor when calling dmsetup
Date: Fri, 11 Sep 2009 12:33:40 -0500	[thread overview]
Message-ID: <4AAA89F4.8060708@sandeen.net> (raw)

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

             reply	other threads:[~2009-09-11 17:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-11 17:33 Eric Sandeen [this message]
2009-09-11 18:51 ` [PATCH] libdisk: use major/minor when calling dmsetup Christoph Hellwig
2009-09-11 19:00   ` Eric Sandeen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AAA89F4.8060708@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox