Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-1870

umount fails with multipath device

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • Lustre 2.4.0
    • Lustre 2.3.0
    • None
    • lustre 2.2.93
      bullxlinux distribution (based on redhat 6.2)
      kernel 2.6.32-220

    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.

      Attachments

        Activity

          People

            bogl Bob Glossman (Inactive)
            pichong Gregoire Pichon
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: