From: izxl007 Date: Sat, 26 Jul 2025 15:30:16 +0000 (+0800) Subject: fuse: improve error handling in fuse_ll_getattr X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c0dd7cbb785349482e9f687001466ac84ed0b77b;p=ceph.git 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 --- 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 }