Skip to content

Commit fb6dd2c

Browse files
committed
client:improve mount error message
Signed-off-by: ningmingxiao <[email protected]>
1 parent 30be5e1 commit fb6dd2c

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

core/mount/mount_linux.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,11 @@ func optionsSize(opts []string) int {
459459

460460
func mountAt(chdir string, source, target, fstype string, flags uintptr, data string) error {
461461
if chdir == "" {
462-
return unix.Mount(source, target, fstype, flags, data)
462+
err := unix.Mount(source, target, fstype, flags, data)
463+
if err != nil {
464+
return fmt.Errorf("mount source: %q, target: %q, fstype: %s, flags: %d, data: %q, err: %w", source, target, fstype, flags, data, err)
465+
}
466+
return nil
463467
}
464468

465469
ch := make(chan error, 1)
@@ -481,8 +485,11 @@ func mountAt(chdir string, source, target, fstype string, flags uintptr, data st
481485
ch <- err
482486
return
483487
}
484-
485-
ch <- unix.Mount(source, target, fstype, flags, data)
488+
err := unix.Mount(source, target, fstype, flags, data)
489+
if err != nil {
490+
err = fmt.Errorf("mount source: %q, target: %q, fstype: %s, flags: %d, data: %q, err: %w", source, target, fstype, flags, data, err)
491+
}
492+
ch <- err
486493
}()
487494
return <-ch
488495
}

0 commit comments

Comments
 (0)