From fb6dd2cf15fa3a0aa885a0ca7146af831dfee42c Mon Sep 17 00:00:00 2001 From: ningmingxiao Date: Thu, 15 May 2025 09:31:28 +0800 Subject: [PATCH] client:improve mount error message Signed-off-by: ningmingxiao --- core/mount/mount_linux.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/core/mount/mount_linux.go b/core/mount/mount_linux.go index 6d63bfad14..86686f15c2 100644 --- a/core/mount/mount_linux.go +++ b/core/mount/mount_linux.go @@ -459,7 +459,11 @@ func optionsSize(opts []string) int { func mountAt(chdir string, source, target, fstype string, flags uintptr, data string) error { if chdir == "" { - return unix.Mount(source, target, fstype, flags, data) + err := unix.Mount(source, target, fstype, flags, data) + if err != nil { + return fmt.Errorf("mount source: %q, target: %q, fstype: %s, flags: %d, data: %q, err: %w", source, target, fstype, flags, data, err) + } + return nil } ch := make(chan error, 1) @@ -481,8 +485,11 @@ func mountAt(chdir string, source, target, fstype string, flags uintptr, data st ch <- err return } - - ch <- unix.Mount(source, target, fstype, flags, data) + err := unix.Mount(source, target, fstype, flags, data) + if err != nil { + err = fmt.Errorf("mount source: %q, target: %q, fstype: %s, flags: %d, data: %q, err: %w", source, target, fstype, flags, data, err) + } + ch <- err }() return <-ch }