From 72db4ac5701185fc3115f115f18fb2250f3050f4 Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Thu, 28 Jul 2016 22:37:38 +0530 Subject: storage/posix: Look for file in "unlink" dir IFF open on real-path fails with ENOENT Backport of: http://review.gluster.org/#/c/15039/ PROBLEM: In some of our users' setups, open() on the anon fd failed for a reason other than ENOENT. But this error code is getting masked by a subsequent open() under posix's hidden "unlink" directory, which will fail with ENOENT because the gfid handle still exists under .glusterfs. And the log message following the two open()s ends up logging ENOENT, causing much confusion. FIX: Look for the presence of the file under "unlink" ONLY if the open() on the real_path failed with ENOENT. Change-Id: Id68bbe98740eea9889b17f8ea3126ed45970d26f BUG: 1360785 Signed-off-by: Krutika Dhananjay Reviewed-on: http://review.gluster.org/15041 Smoke: Gluster Build System Reviewed-by: Pranith Kumar Karampuri NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System --- xlators/storage/posix/src/posix-helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index 5831035815e..b97545262fb 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -1677,7 +1677,7 @@ __posix_fd_ctx_get (fd_t *fd, xlator_t *this, struct posix_fd **pfd_p, */ if (fd->inode->ia_type == IA_IFREG) { _fd = open (real_path, fd->flags); - if (_fd == -1) { + if ((_fd == -1) && (errno == ENOENT)) { POSIX_GET_FILE_UNLINK_PATH (priv->base_path, fd->inode->gfid, unlink_path); -- cgit