X-Spam-Checker-Version: SpamAssassin 3.3.0-rupdated (updated) on oss.sgi.com X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_43 autolearn=no version=3.3.0-rupdated Received: from cuda.sgi.com (cuda3.sgi.com [192.48.176.15]) by oss.sgi.com (8.14.3/8.14.3/SuSE Linux 0.8) with ESMTP id n8BHWVFl037408 for ; Fri, 11 Sep 2009 12:32:31 -0500 X-ASG-Debug-ID: 1252690421-3dff00350000-NocioJ X-Barracuda-URL: http://cuda.sgi.com:80/cgi-bin/mark.cgi Received: from mail.sandeen.net (localhost [127.0.0.1]) by cuda.sgi.com (Spam Firewall) with ESMTP id B9D471BEA20B for ; Fri, 11 Sep 2009 10:33:41 -0700 (PDT) Received: from mail.sandeen.net (sandeen.net [209.173.210.139]) by cuda.sgi.com with ESMTP id XVto0b0ZrVHpGgHc for ; Fri, 11 Sep 2009 10:33:41 -0700 (PDT) Received: from liberator.sandeen.net (liberator.sandeen.net [10.0.0.4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sandeen.net (Postfix) with ESMTP id DD4B8AAE3AE for ; Fri, 11 Sep 2009 12:33:40 -0500 (CDT) Message-ID: <4AAA89F4.8060708@sandeen.net> Date: Fri, 11 Sep 2009 12:33:40 -0500 From: Eric Sandeen User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812) MIME-Version: 1.0 To: xfs-oss X-ASG-Orig-Subj: [PATCH] libdisk: use major/minor when calling dmsetup Subject: [PATCH] libdisk: use major/minor when calling dmsetup Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Barracuda-Connect: sandeen.net[209.173.210.139] X-Barracuda-Start-Time: 1252690422 X-Barracuda-Bayes: INNOCENT GLOBAL 0.0000 1.0000 -2.0210 X-Barracuda-Virus-Scanned: by cuda.sgi.com at sgi.com X-Barracuda-Spam-Score: -2.02 X-Barracuda-Spam-Status: No, SCORE=-2.02 using per-user scores of TAG_LEVEL=2.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=2.1 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.8736 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on oss.sgi.com X-Virus-Status: Clean 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 --- 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) {