diff options
Diffstat (limited to 'xlators/mount/fuse/src/fuse-bridge.c')
-rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.c | 79 |
1 files changed, 59 insertions, 20 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index 81697593b7e..dd51f5a6608 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -550,12 +550,32 @@ fuse_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } void +fuse_fop_resume (fuse_state_t *state) +{ + fuse_resume_fn_t fn = NULL; + + /* + * Fail fd resolution failures right away. + */ + if (state->resolve.fd && state->resolve.op_ret < 0) { + send_fuse_err (state->this, state->finh, + state->resolve.op_errno); + free_fuse_state (state); + return; + } + + fn = state->resume_fn; + fn (state); +} + +void fuse_lookup_resume (fuse_state_t *state) { if (!state->loc.parent && !state->loc.inode) { gf_log ("fuse", GF_LOG_ERROR, "failed to resolve path %s", state->loc.path); - send_fuse_err (state->this, state->finh, ENOENT); + send_fuse_err (state->this, state->finh, + state->resolve.op_errno); free_fuse_state (state); return; } @@ -786,7 +806,8 @@ fuse_getattr_resume (fuse_state_t *state) "%"PRIu64": GETATTR %"PRIu64" (%s) resolution failed", state->finh->unique, state->finh->nodeid, uuid_utoa (state->resolve.gfid)); - send_fuse_err (state->this, state->finh, ENOENT); + send_fuse_err (state->this, state->finh, + state->resolve.op_errno); free_fuse_state (state); return; } @@ -1109,7 +1130,8 @@ fuse_setattr_resume (fuse_state_t *state) "%"PRIu64": SETATTR %"PRIu64" (%s) resolution failed", state->finh->unique, state->finh->nodeid, uuid_utoa (state->resolve.gfid)); - send_fuse_err (state->this, state->finh, ENOENT); + send_fuse_err (state->this, state->finh, + state->resolve.op_errno); free_fuse_state (state); return; } @@ -1316,7 +1338,8 @@ fuse_access_resume (fuse_state_t *state) "%"PRIu64": ACCESS %"PRIu64" (%s) resolution failed", state->finh->unique, state->finh->nodeid, uuid_utoa (state->resolve.gfid)); - send_fuse_err (state->this, state->finh, ENOENT); + send_fuse_err (state->this, state->finh, + state->resolve.op_errno); free_fuse_state (state); return; } @@ -1390,7 +1413,8 @@ fuse_readlink_resume (fuse_state_t *state) gf_log ("glusterfs-fuse", GF_LOG_ERROR, "READLINK %"PRIu64" (%s) resolution failed", state->finh->unique, uuid_utoa (state->resolve.gfid)); - send_fuse_err (state->this, state->finh, ENOENT); + send_fuse_err (state->this, state->finh, + state->resolve.op_errno); free_fuse_state (state); return; } @@ -1425,7 +1449,8 @@ fuse_mknod_resume (fuse_state_t *state) "MKNOD %"PRIu64"/%s (%s/%s) resolution failed", state->finh->nodeid, state->resolve.bname, uuid_utoa (state->resolve.gfid), state->resolve.bname); - send_fuse_err (state->this, state->finh, ENOENT); + send_fuse_err (state->this, state->finh, + state->resolve.op_errno); free_fuse_state (state); return; } @@ -1495,7 +1520,8 @@ fuse_mkdir_resume (fuse_state_t *state) "MKDIR %"PRIu64" (%s/%s) resolution failed", state->finh->nodeid, uuid_utoa (state->resolve.gfid), state->resolve.bname); - send_fuse_err (state->this, state->finh, ENOENT); + send_fuse_err (state->this, state->finh, + state->resolve.op_errno); free_fuse_state (state); return; } @@ -1559,7 +1585,8 @@ fuse_unlink_resume (fuse_state_t *state) "UNLINK %"PRIu64" (%s/%s) resolution failed", state->finh->nodeid, uuid_utoa (state->resolve.gfid), state->resolve.bname); - send_fuse_err (state->this, state->finh, ENOENT); + send_fuse_err (state->this, state->finh, + state->resolve.op_errno); free_fuse_state (state); return; } @@ -1595,7 +1622,8 @@ fuse_rmdir_resume (fuse_state_t *state) "RMDIR %"PRIu64" (%s/%s) resolution failed", state->finh->nodeid, uuid_utoa (state->resolve.gfid), state->resolve.bname); - send_fuse_err (state->this, state->finh, ENOENT); + send_fuse_err (state->this, state->finh, + state->resolve.op_errno); free_fuse_state (state); return; } @@ -1631,7 +1659,8 @@ fuse_symlink_resume (fuse_state_t *state) "SYMLINK %"PRIu64" (%s/%s) -> %s resolution failed", state->finh->nodeid, uuid_utoa (state->resolve.gfid), state->resolve.bname, state->name); - send_fuse_err (state->this, state->finh, ENOENT); + send_fuse_err (state->this, state->finh, + state->resolve.op_errno); free_fuse_state (state); return; } @@ -1747,7 +1776,8 @@ fuse_rename_resume (fuse_state_t *state) uuid_utoa_r (state->resolve2.gfid, loc2_uuid), state->resolve2.bname); - send_fuse_err (state->this, state->finh, ENOENT); + send_fuse_err (state->this, state->finh, + state->resolve.op_errno); free_fuse_state (state); return; } @@ -1804,7 +1834,8 @@ fuse_link_resume (fuse_state_t *state) gf_log ("glusterfs-fuse", GF_LOG_WARNING, "fuse_loc_fill() failed %"PRIu64": LINK %s %s", state->finh->unique, state->loc2.path, state->loc.path); - send_fuse_err (state->this, state->finh, ENOENT); + send_fuse_err (state->this, state->finh, + state->resolve.op_errno); free_fuse_state (state); return; } @@ -1956,7 +1987,8 @@ fuse_create_resume (fuse_state_t *state) "%"PRIu64" CREATE %s/%s resolution failed", state->finh->unique, uuid_utoa (state->resolve.gfid), state->resolve.bname); - send_fuse_err (state->this, state->finh, ENOENT); + send_fuse_err (state->this, state->finh, + state->resolve.op_errno); free_fuse_state (state); return; } @@ -2062,7 +2094,8 @@ fuse_open_resume (fuse_state_t *state) "%"PRIu64": OPEN %s resolution failed", state->finh->unique, uuid_utoa (state->resolve.gfid)); - send_fuse_err (state->this, state->finh, ENOENT); + send_fuse_err (state->this, state->finh, + state->resolve.op_errno); free_fuse_state (state); return; } @@ -2460,7 +2493,8 @@ fuse_opendir_resume (fuse_state_t *state) gf_log ("glusterfs-fuse", GF_LOG_WARNING, "%"PRIu64": OPENDIR (%s) resolution failed", state->finh->unique, uuid_utoa (state->resolve.gfid)); - send_fuse_err (state->this, state->finh, ENOENT); + send_fuse_err (state->this, state->finh, + state->resolve.op_errno); free_fuse_state (state); return; } @@ -2992,7 +3026,8 @@ fuse_statfs_resume (fuse_state_t *state) "%"PRIu64": STATFS (%s) resolution fail", state->finh->unique, uuid_utoa (state->resolve.gfid)); - send_fuse_err (state->this, state->finh, ENOENT); + send_fuse_err (state->this, state->finh, + state->resolve.op_errno); free_fuse_state (state); return; } @@ -3027,7 +3062,8 @@ fuse_setxattr_resume (fuse_state_t *state) "resolution failed", state->finh->unique, uuid_utoa (state->resolve.gfid), state->finh->nodeid, state->name); - send_fuse_err (state->this, state->finh, ENOENT); + send_fuse_err (state->this, state->finh, + state->resolve.op_errno); free_fuse_state (state); return; } @@ -3326,7 +3362,8 @@ fuse_getxattr_resume (fuse_state_t *state) uuid_utoa (state->resolve.gfid), state->finh->nodeid, state->name); - send_fuse_err (state->this, state->finh, ENOENT); + send_fuse_err (state->this, state->finh, + state->resolve.op_errno); free_fuse_state (state); return; } @@ -3471,7 +3508,8 @@ fuse_listxattr_resume (fuse_state_t *state) "resolution failed", state->finh->unique, uuid_utoa (state->resolve.gfid), state->finh->nodeid); - send_fuse_err (state->this, state->finh, ENOENT); + send_fuse_err (state->this, state->finh, + state->resolve.op_errno); free_fuse_state (state); return; } @@ -3526,7 +3564,8 @@ fuse_removexattr_resume (fuse_state_t *state) state->finh->unique, uuid_utoa (state->resolve.gfid), state->finh->nodeid, state->name); - send_fuse_err (state->this, state->finh, ENOENT); + send_fuse_err (state->this, state->finh, + state->resolve.op_errno); free_fuse_state (state); return; } |