From 0d3bec589748b4cc8295d9ed109d21c94e3d8854 Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Mon, 17 Sep 2012 12:56:49 -0700 Subject: mount/fuse: treat NULL gfid is a failure in lookup disregarding op_ret It is not possible to inode_link() with a NULL gfid. If a lookup (or any other "entry" op) returns a success but has a NULL gfid, then treat it as a failure even if op_ret was 0. Currently AFR does this when self-healing fails/aborts in certain situations (like entrylk acquisition failure, gfid mismatch etc.) returning a NULL gfid in struct iatt of lookup_cbk with op_ret = 0. Fixing this is an independent patch and fuse-bridge needs to be robust against such misformed replies in any case. Change-Id: If5f75780c0b5b1303f466711f1992f90a77e768a BUG: 856921 Signed-off-by: Anand Avati Reviewed-on: http://review.gluster.org/3952 Tested-by: Gluster Build System Reviewed-by: Brian Foster --- xlators/mount/fuse/src/fuse-bridge.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'xlators/mount/fuse') diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index bced86442..6dfc334be 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -295,8 +295,20 @@ fuse_entry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, state = frame->root->state; finh = state->finh; - if (!op_ret && __is_root_gfid (state->loc.inode->gfid)) { - buf->ia_ino = 1; + if (op_ret == 0) { + if (__is_root_gfid (state->loc.inode->gfid)) + buf->ia_ino = 1; + if (uuid_is_null (buf->ia_gfid)) { + /* With a NULL gfid inode linking is + not possible. Let's not pretend this + call was a "success". + */ + gf_log ("glusterfs-fuse", GF_LOG_WARNING, + "Received NULL gfid for %s. Forcing EIO", + state->loc.path); + op_ret = -1; + op_errno = EIO; + } } if (op_ret == 0) { -- cgit