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>
(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
}