Skip to content

Commit c0dd7cb

Browse files
committed
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 <[email protected]>
1 parent 5abc34b commit c0dd7cb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/client/fuse_ll.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,13 +389,14 @@ static void fuse_ll_getattr(fuse_req_t req, fuse_ino_t ino,
389389

390390
(void) fi; // XXX
391391

392-
if (cfuse->client->ll_getattr(in, &stbuf, perms)
393-
== 0) {
392+
int r = cfuse->client->ll_getattr(in, &stbuf, perms);
393+
if (r == 0) {
394394
stbuf.st_ino = cfuse->make_fake_ino(stbuf.st_ino, stbuf.st_dev);
395395
stbuf.st_rdev = new_encode_dev(stbuf.st_rdev);
396396
fuse_reply_attr(req, &stbuf, 0);
397397
} else
398-
fuse_reply_err(req, ENOENT);
398+
fuse_reply_err(req, get_sys_errno(-r));
399+
399400

400401
cfuse->iput(in); // iput required
401402
}

0 commit comments

Comments
 (0)