UPSTREAM: 48709: glusterfs: retry without auto_unmount only when it's not supported
@@ -342,24 +342,24 @@ func (b *glusterfsMounter) setUpAtInternal(dir string) error {
return nil
}
+ const invalidOption = "Invalid option auto_unmount"
+ if dstrings.Contains(errs.Error(), invalidOption) {
// Give a try without `auto_unmount mount option, because
// it could be that gluster fuse client is older version and
// mount.glusterfs is unaware of `auto_unmount`.
- // Use a mount string without `auto_unmount``
-
- autoMountOptions := make([]string, len(mountOptions))
+ noAutoMountOptions := make([]string, len(mountOptions))
for _, opt := range mountOptions {
if opt != "auto_unmount" {
- autoMountOptions = append(autoMountOptions, opt)
+ noAutoMountOptions = append(noAutoMountOptions, opt)
}
}
- autoerrs := b.mounter.Mount(ip+":"+b.path, dir, "glusterfs", autoMountOptions)
- if autoerrs == nil {
+ errs = b.mounter.Mount(ip+":"+b.path, dir, "glusterfs", noAutoMountOptions)
+ if errs == nil {
glog.Infof("glusterfs: successfully mounted %s", dir)
return nil
}
-
+ }
}
// Failed mount scenario.
