]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
fuse: improve error handling in fuse_ll_getattr 64701/head
authorizxl007 <zeng.zheng@zte.com.cn>
Sat, 26 Jul 2025 15:30:16 +0000 (23:30 +0800)
committerizxl007 <zeng.zheng@zte.com.cn>
Sat, 26 Jul 2025 15:30:16 +0000 (23:30 +0800)
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 <zeng.zheng@zte.com.cn>
src/client/fuse_ll.cc

index faf33d1bbce74ddf4f144c5bb3a173e2d2c969b7..b8398bb09b24c24b76992924c0ff971840fcd242 100644 (file)
@@ -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
 }