[LU-1870] umount fails with multipath device Created: 10/Sep/12  Updated: 18/Oct/12  Resolved: 18/Oct/12

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

Type: Bug Priority: Minor
Reporter: Gregoire Pichon Assignee: Bob Glossman (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Environment:

lustre 2.2.93
bullxlinux distribution (based on redhat 6.2)
kernel 2.6.32-220


Severity: 3
Epic: mount, server
Rank (Obsolete): 4417

 Description   

Unmount of lustre target fails when target device is a multipath device.

# mount -t lustre /dev/dm-47 /mnt/fsperf/ost/0
# cat /etc/mtab
/dev/dm-47 /mnt/fsperf/ost/0 lustre rw 0 0

# cat /sys/block/dm-47/dm/name
mpathau
# ls -l /dev/mapper/mpathau 
lrwxrwxrwx 1 root root 8 Sep  7 09:54 /dev/mapper/mpathau -> ../dm-47

# umount /dev/dm-47
umount: /dev/dm-47: not mounted
# umount -v /dev/dm-47
Could not find /dev/mapper/mpathau in mtab
# umount -v /dev/mapper/mpathau
Could not find /dev/mapper/mpathau in mtab
umount: /dev/mapper/mpathau: not mounted

This is because mount.lustre and umount commands do not handle multipath devices the same way.

'mount.lustre /dev/dm-47' inserts an entry in /etc/mtab with device named: /dev/dm-47
'umount /dev/dm-47' looks for an entry in /etc/mtab named: /dev/mapper/mpathau.

In previous lustre version, the mount.lustre command was insterting in /etc/mtab the '/dev/mapper/mpathau' device name. This changed with commit 2d7e03100adb7975601a194e476bee50d8e2413c for LU-1581 because computation of '/dev/mapper/mpathxx' name has no effect on mo_usource field since the string was duplicated from real_path: 'strdup(real_path)'.

        /**
         * Try to get the real path to the device, in case it is a
         * symbolic link for instance
         */
        if (realpath(mop->mo_usource, real_path) != NULL) {
                mop->mo_usource = strdup(real_path);

                ptr = strrchr(real_path, '/');
                if (ptr && strncmp(ptr, "/dm-", 4) == 0 && isdigit(*(ptr + 4))) {
                        snprintf(path, sizeof(path), "/sys/block/%s/dm/name", ptr+1);
                        if ((f = fopen(path, "r"))) {
                                /* read "<name>\n" from sysfs */
                                if (fgets(name, sizeof(name), f) && (sz = strlen(name)) > 1) {
                                        name[sz - 1] = '\0';
                                        snprintf(real_path, sizeof(real_path), "/dev/mapper/%s", name);
                                }
                                fclose(f);
                        }
                }
        }

I will provide a patch.



 Comments   
Comment by Gregoire Pichon [ 10/Sep/12 ]

Here is the patch for master: http://review.whamcloud.com/3922

Comment by Peter Jones [ 10/Sep/12 ]

Thanks for the patch Gregoire.

Bob

Could you please take care of getting this patch landed

Thanks

Peter

Comment by Gregoire Pichon [ 18/Oct/12 ]

The fix has been merged into master the 2nd, October.

This ticket can be marked Resolved.

Comment by Peter Jones [ 18/Oct/12 ]

Thanks Gregoire! Landed for 2.4

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