Skip to content

Commit 212d149

Browse files
authored
PWX-36522: In case of devices use Exact match with mount and not a prefix match (#2431)
Signed-off-by: pnookala-px <pnookala@purestorage.com>
1 parent f44fbeb commit 212d149

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

pkg/mount/mount.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ func (m *Mounter) reload(device string, newM *Info) error {
368368
}
369369

370370
// Purge old mounts.
371-
logrus.Infof("Reload: Adding the device tuple {%v:%v] to mount table", device, newM.Fs)
371+
logrus.Infof("Reload: Adding the device tuple [%v:%v] to mount table", device, newM.Fs)
372372
m.mounts[device] = newM
373373
return nil
374374
}
@@ -387,12 +387,15 @@ func (m *Mounter) load(prefixes []*regexp.Regexp, fmp findMountPoint) error {
387387
foundPrefix, sourcePath, devicePath = fmp(v, devPrefix, info)
388388
targetDevice = getTargetDevice(devPrefix.String())
389389
if !foundPrefix && targetDevice != "" {
390-
foundTarget, _, _ = fmp(v, regexp.MustCompile(regexp.QuoteMeta(targetDevice)), info)
391-
// We could not find a mountpoint for devPrefix (/dev/mapper/vg-lvm1) but found
392-
// one for its target device (/dev/dm-0). Change the sourcePath to devPrefix
393-
// as fmp might have returned an incorrect or empty sourcePath
394-
sourcePath = devPrefix.String()
395-
devicePath = devPrefix.String()
390+
// This should be an Exact Match and not a prefix match.
391+
if strings.EqualFold(targetDevice, v.Source) {
392+
// We could not find a mountpoint for devPrefix (/dev/mapper/vg-lvm1) but found
393+
// one for its target device (/dev/dm-0). Change the sourcePath to devPrefix
394+
// as fmp might have returned an incorrect or empty sourcePath
395+
sourcePath = devPrefix.String()
396+
devicePath = devPrefix.String()
397+
foundTarget = true
398+
}
396399
}
397400

398401
if foundPrefix || foundTarget {

0 commit comments

Comments
 (0)