Skip to content

Commit

Permalink
add device guard to lustre mount
Browse files Browse the repository at this point in the history
  • Loading branch information
bdevcich committed Nov 13, 2024
1 parent da73f92 commit 24af96b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/filesystem/lustre.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,9 @@ func (l *LustreFileSystem) Mount(ctx context.Context, path string, complete bool
}

// Found an existing mount at this path. Check if it's the mount we expect
if m.Type != "lustre" {
return false, fmt.Errorf("unexpected mount at path %s. Device %s type %s", path, m.Device, m.Type)
devStr := fmt.Sprintf("%s:/%s", l.MgsAddress, l.Name)
if m.Device != devStr || m.Type != "lustre" {
return false, fmt.Errorf("unexpected mount at path %s. Expected device %s of type lustre, found device %s type %s", path, devStr, m.Device, m.Type)
}

// The file system is already mounted. Nothing left to do
Expand Down Expand Up @@ -259,8 +260,7 @@ func (l *LustreFileSystem) Unmount(ctx context.Context, path string) (bool, erro
// Found an existing mount at this path. Check if it's the mount we expect
devStr := fmt.Sprintf("%s:/%s", l.MgsAddress, l.Name)
if m.Device != devStr || m.Type != "lustre" {
l.Log.Info("BLAKE unexpected mount", "device", m.Device, "device string", devStr, "path", path, "m.path", m.Path)
return false, fmt.Errorf("unexpected mount at path %s. Device %s type %s", path, m.Device, m.Type)
return false, fmt.Errorf("unexpected mount at path %s. Expected device %s of type lustre, found device %s type %s", path, devStr, m.Device, m.Type)
}

if _, err := command.Run(fmt.Sprintf("umount %s", path), l.Log); err != nil {
Expand Down

0 comments on commit 24af96b

Please sign in to comment.