[LU-2337] Init scripts incorrectly detect '/dev/mapper' when importing pool Created: 15/Nov/12  Updated: 19/Apr/13  Resolved: 19/Apr/13

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.4.0
Fix Version/s: Lustre 2.4.0

Type: Bug Priority: Minor
Reporter: Prakash Surya (Inactive) Assignee: Prakash Surya (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Severity: 3
Rank (Obsolete): 5583

 Description   

If the /dev/mapper directory is present, but not used by ZFS, the init scripts will fail to import a zpool.

For example:

$ sudo /etc/init.d/lustre start
$ mount | grep lustre

The following patch fixes the issue for my unique case:

diff --git i/lustre/scripts/lustre w/lustre/scripts/lustre
index 55c6601..8c594ac 100644
--- i/lustre/scripts/lustre
+++ w/lustre/scripts/lustre
@@ -104,8 +104,6 @@ import_zpool ()
                args="$args -d $ZPOOL_IMPORT_DIR"
        elif [ -d "/dev/disk/by-vdev" ] ; then
                args="$args -d /dev/disk/by-vdev"
-       elif [ -d "/dev/mapper" ] ; then
-               args="$args -d /dev/mapper"
        fi
 
        if zpool status $pool >/dev/null 2>&1 ; then
$ sudo /etc/init.d/lustre start
Mounting lustre-oss/ost0 on /mnt/lustre/local/lustre-OST0000
$ mount | grep lustre
lustre-oss/ost0 on /mnt/lustre/local/lustre-OST0000 type lustre (rw)

But this is definitely not a correct fix, as it will break sites using multipath for ZFS pools.

My zpool uses the /dev/vdb device directly:

sudo zpool status
  pool: lustre-oss
 state: ONLINE
 scan: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        lustre-oss  ONLINE       0     0     0
          vdb1      ONLINE       0     0     0

errors: No known data errors

And /dev/mapper contains entries for my root filesystem:

$ ls -l /dev/mapper
total 0
crw-rw---- 1 root root 10, 58 Nov 15 10:39 control
lrwxrwxrwx 1 root root      7 Nov 15 10:39 vg_toss-lv_root -> ../dm-0
lrwxrwxrwx 1 root root      7 Nov 15 10:39 vg_toss-lv_swap -> ../dm-1


 Comments   
Comment by Ned Bass [ 15/Nov/12 ]

Our thinking was that sites that can't use the default import paths should override ZPOOL_IMPORT_DIR in /etc/sysconfig/lustre. Better error reporting is probably in order.

Comment by Prakash Surya (Inactive) [ 15/Nov/12 ]

What do you mean by "default import paths"? I think /dev is as good of a "default" as any. We should strive to make it "just work" for the simplest use case, IMO. Even when using the /etc/zfs/zdev.conf file it fails because links are created in /dev/disk/zpool, which is never checked by the init script.

Comment by Ned Bass [ 15/Nov/12 ]

What do you mean by "default import paths"?

I mean the default behavior of the script.

I think /dev is as good of a "default" as any.

Use of /dev is discouraged since the names generally are not persistent. However, I'm not convinced using /dev/mapper by default is a great idea either. Honestly, I think we put that in to make it "just work" for grove.

Even when using the /etc/zfs/zdev.conf file it fails because links are created in /dev/disk/zpool, which is never checked by the init script.

The plan is to deprecate /dev/disk/zpool and /etc/zfs/zdev.conf, as they are superceded by /dev/disk/by-vdev and /etc/zfs/vdev_id.conf. See https://github.com/zfsonlinux/zfs/issues/981. I guess I should revive that effort.

Comment by Prakash Surya (Inactive) [ 15/Nov/12 ]

Use of /dev is discouraged since the names generally are not persistent.

Sure, but it's ultimately up to the user to make that decision. Using /dev should "just work", IMO.

However, I'm not convinced using /dev/mapper by default is a great idea either. Honestly, I think we put that in to make it "just work" for grove.

Agreed. Personally, I think it should omit the -d option entirely by default, and use when it detects -d is necessary and correct. Which appears to be the current intended behavior, the detection is just flawed for this use case.

I'd hate to add a complicated detection mechanism for /dev/mapper, but it should definitely work out of the box for a simple VM set up like I have.

Comment by Ned Bass [ 15/Nov/12 ]

Right, now that the import search behaviour has been improved we no longer need -d, unless ZPOOL_IMPORT_DIR is set.

Comment by Ned Bass [ 27/Nov/12 ]

http://review.whamcloud.com/4686

Comment by Prakash Surya (Inactive) [ 08/Jan/13 ]

The patch landed on master.

Generated at Sat Feb 10 01:24:21 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.