Skip to content

Commit

Permalink
fix: Disable uuid checks on XFS
Browse files Browse the repository at this point in the history
Add 'nouuid' mount option to all XFS mounts to be able to mount a volume
and its restored snapshot on the same node. Without the option, such a
mount fails, because XFS detects that two different volumes with the same
filesystem UUID are being mounted.
  • Loading branch information
jsafrane committed Jul 30, 2021
1 parent 9759544 commit fb62c15
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion pkg/azuredisk/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe
if mnt.FsType != "" {
fstype = mnt.FsType
}
options = append(options, mnt.MountFlags...)
options = append(options, collectMountOptions(fstype, mnt.MountFlags)...)
}

volContextFSType := getFStype(req.GetVolumeContext())
Expand Down Expand Up @@ -600,3 +600,18 @@ func (d *Driver) ensureBlockTargetFile(target string) error {

return nil
}

func collectMountOptions(fsType string, mntFlags []string) []string {
var options []string

for _, opt := range mntFlags {
options = append(options, opt)
}

// By default, xfs does not allow mounting of two volumes with the same filesystem uuid.
// Force ignore this uuid to be able to mount volume + its clone / restored snapshot on the same node.
if fsType == "xfs" {
options = append(options, "nouuid")
}
return options
}

0 comments on commit fb62c15

Please sign in to comment.