From c0dd7cbb785349482e9f687001466ac84ed0b77b Mon Sep 17 00:00:00 2001 From: izxl007 Date: Sat, 26 Jul 2025 23:30:16 +0800 Subject: [PATCH] fuse: improve error handling in fuse_ll_getattr Currently, fuse_ll_getattr always returns ENOENT when ll_getattr fails, which masks the actual error conditions. This makes debugging and error handling difficult for applications using ceph-fuse. This change preserves the original error code from ll_getattr and converts it to the appropriate system error code using get_sys_errno(), allowing applications to receive accurate error information. Signed-off-by: izxl007 --- src/client/fuse_ll.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/client/fuse_ll.cc b/src/client/fuse_ll.cc index faf33d1bbce..b8398bb09b2 100644 --- a/src/client/fuse_ll.cc +++ b/src/client/fuse_ll.cc @@ -389,13 +389,14 @@ static void fuse_ll_getattr(fuse_req_t req, fuse_ino_t ino, (void) fi; // XXX - if (cfuse->client->ll_getattr(in, &stbuf, perms) - == 0) { + int r = cfuse->client->ll_getattr(in, &stbuf, perms); + if (r == 0) { stbuf.st_ino = cfuse->make_fake_ino(stbuf.st_ino, stbuf.st_dev); stbuf.st_rdev = new_encode_dev(stbuf.st_rdev); fuse_reply_attr(req, &stbuf, 0); } else - fuse_reply_err(req, ENOENT); + fuse_reply_err(req, get_sys_errno(-r)); + cfuse->iput(in); // iput required } -- 2.47.3