From 3a392704f61915217f4f8210e1dd94901d6938bb Mon Sep 17 00:00:00 2001
From: Raghavendra G <rgowdapp@redhat.com>
Date: Tue, 11 Sep 2018 10:31:27 +0530
Subject: [PATCH 368/385] mount/fuse: convert ENOENT to ESTALE in
open(dir)_resume
This patch is continuation of commit
fb4b914ce84bc83a5f418719c5ba7c25689a9251.
<snip>
mount/fuse: never fail open(dir) with ENOENT
open(dir) being an operation on inode should never fail with
ENOENT. If gfid is not present, the appropriate error is
ESTALE. This will enable kernel to retry open after a revalidate
lookup.
</snip>
Earlier commit failed to fix codepath where error response is sent
back on gfid resolution failures in fuse_open(dir)_resume. Current
patch completes that work
>Change-Id: Ia07e3cece404811703c8cfbac9b402ca5fe98c1e
>Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
>updates: bz#1627620
Change-Id: Ia07e3cece404811703c8cfbac9b402ca5fe98c1e
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
BUG: 1627617
upstream patch: https://review.gluster.org/#/c/glusterfs/+/21146/
Reviewed-on: https://code.engineering.redhat.com/gerrit/150109
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
xlators/mount/fuse/src/fuse-bridge.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index b767ea4..85cee73 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -2235,6 +2235,10 @@ fuse_open_resume (fuse_state_t *state)
"%"PRIu64": OPEN %s resolution failed",
state->finh->unique, uuid_utoa (state->resolve.gfid));
+ /* facilitate retry from VFS */
+ if (state->resolve.op_errno == ENOENT)
+ state->resolve.op_errno = ESTALE;
+
send_fuse_err (state->this, state->finh,
state->resolve.op_errno);
free_fuse_state (state);
@@ -2687,6 +2691,11 @@ 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));
+
+ /* facilitate retry from VFS */
+ if (state->resolve.op_errno == ENOENT)
+ state->resolve.op_errno = ESTALE;
+
send_fuse_err (state->this, state->finh,
state->resolve.op_errno);
free_fuse_state (state);
--
1.8.3.1