|
|
cb8e9e |
From 7660b98f1987c24746fe912065a474c7fa189644 Mon Sep 17 00:00:00 2001
|
|
|
cb8e9e |
From: vmallika <vmallika@redhat.com>
|
|
|
cb8e9e |
Date: Fri, 7 Aug 2015 15:51:53 +0530
|
|
|
cb8e9e |
Subject: [PATCH 260/279] posix: posix_make_ancestryfromgfid shouldn't log ENOENT
|
|
|
cb8e9e |
|
|
|
cb8e9e |
This is a backport of http://review.gluster.org/11861
|
|
|
cb8e9e |
|
|
|
cb8e9e |
posix_make_ancestryfromgfid shouldn't log ENOENT
|
|
|
cb8e9e |
and it should set proper op_errno
|
|
|
cb8e9e |
|
|
|
cb8e9e |
> Change-Id: I8a87f30bc04d33cab06c91c74baa9563a1c7b45d
|
|
|
cb8e9e |
> BUG: 1251449
|
|
|
cb8e9e |
> Signed-off-by: vmallika <vmallika@redhat.com>
|
|
|
cb8e9e |
> Reviewed-on: http://review.gluster.org/11861
|
|
|
cb8e9e |
> Tested-by: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
cb8e9e |
> Tested-by: Gluster Build System <jenkins@build.gluster.com>
|
|
|
cb8e9e |
> Reviewed-by: Manikandan Selvaganesh <mselvaga@redhat.com>
|
|
|
cb8e9e |
> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
|
|
|
cb8e9e |
|
|
|
cb8e9e |
Change-Id: I5e17413b09ef726b1eeec46adbbce1e5f0503da9
|
|
|
cb8e9e |
BUG: 1229621
|
|
|
cb8e9e |
Signed-off-by: vmallika <vmallika@redhat.com>
|
|
|
cb8e9e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/55078
|
|
|
cb8e9e |
Reviewed-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
|
|
|
cb8e9e |
Tested-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
|
|
|
cb8e9e |
---
|
|
|
cb8e9e |
xlators/storage/posix/src/posix-handle.c | 17 ++++++++++++-----
|
|
|
cb8e9e |
xlators/storage/posix/src/posix-handle.h | 2 +-
|
|
|
cb8e9e |
xlators/storage/posix/src/posix.c | 5 +++--
|
|
|
cb8e9e |
3 files changed, 16 insertions(+), 8 deletions(-)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
diff --git a/xlators/storage/posix/src/posix-handle.c b/xlators/storage/posix/src/posix-handle.c
|
|
|
cb8e9e |
index 281d52f..96e7098 100644
|
|
|
cb8e9e |
--- a/xlators/storage/posix/src/posix-handle.c
|
|
|
cb8e9e |
+++ b/xlators/storage/posix/src/posix-handle.c
|
|
|
cb8e9e |
@@ -102,7 +102,7 @@ posix_make_ancestryfromgfid (xlator_t *this, char *path, int pathsize,
|
|
|
cb8e9e |
gf_dirent_t *head, int type, uuid_t gfid,
|
|
|
cb8e9e |
const size_t handle_size,
|
|
|
cb8e9e |
const char *priv_base_path, inode_table_t *itable,
|
|
|
cb8e9e |
- inode_t **parent, dict_t *xdata)
|
|
|
cb8e9e |
+ inode_t **parent, dict_t *xdata, int32_t *op_errno)
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
char *linkname = NULL; /* "../../<gfid[0]>/
|
|
|
cb8e9e |
"<gfidstr>/<NAME_MAX>" */
|
|
|
cb8e9e |
@@ -117,6 +117,7 @@ posix_make_ancestryfromgfid (xlator_t *this, char *path, int pathsize,
|
|
|
cb8e9e |
uuid_t tmp_gfid = {0, };
|
|
|
cb8e9e |
|
|
|
cb8e9e |
if (!path || !parent || !priv_base_path || gf_uuid_is_null (gfid)) {
|
|
|
cb8e9e |
+ *op_errno = EINVAL;
|
|
|
cb8e9e |
goto out;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -138,6 +139,8 @@ posix_make_ancestryfromgfid (xlator_t *this, char *path, int pathsize,
|
|
|
cb8e9e |
ret = posix_make_ancestral_node (priv_base_path, path, pathsize,
|
|
|
cb8e9e |
head, "/", &iabuf, inode, type,
|
|
|
cb8e9e |
xdata);
|
|
|
cb8e9e |
+ if (ret < 0)
|
|
|
cb8e9e |
+ *op_errno = ENOMEM;
|
|
|
cb8e9e |
return ret;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -149,9 +152,12 @@ posix_make_ancestryfromgfid (xlator_t *this, char *path, int pathsize,
|
|
|
cb8e9e |
|
|
|
cb8e9e |
len = readlink (dir_handle, linkname, PATH_MAX);
|
|
|
cb8e9e |
if (len < 0) {
|
|
|
cb8e9e |
- gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_READLINK_FAILED,
|
|
|
cb8e9e |
- "could not read the link from the gfid handle %s ",
|
|
|
cb8e9e |
- dir_handle);
|
|
|
cb8e9e |
+ gf_msg (this->name, (errno == ENOENT || errno == ESTALE)
|
|
|
cb8e9e |
+ ? GF_LOG_DEBUG:GF_LOG_ERROR, errno,
|
|
|
cb8e9e |
+ P_MSG_READLINK_FAILED, "could not read the link from "
|
|
|
cb8e9e |
+ "the gfid handle %s ", dir_handle);
|
|
|
cb8e9e |
+ ret = -1;
|
|
|
cb8e9e |
+ *op_errno = errno;
|
|
|
cb8e9e |
goto out;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -165,7 +171,7 @@ posix_make_ancestryfromgfid (xlator_t *this, char *path, int pathsize,
|
|
|
cb8e9e |
ret = posix_make_ancestryfromgfid (this, path, pathsize, head, type,
|
|
|
cb8e9e |
tmp_gfid, handle_size,
|
|
|
cb8e9e |
priv_base_path, itable, parent,
|
|
|
cb8e9e |
- xdata);
|
|
|
cb8e9e |
+ xdata, op_errno);
|
|
|
cb8e9e |
if (ret < 0) {
|
|
|
cb8e9e |
goto out;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
@@ -174,6 +180,7 @@ posix_make_ancestryfromgfid (xlator_t *this, char *path, int pathsize,
|
|
|
cb8e9e |
|
|
|
cb8e9e |
inode = posix_resolve (this, itable, *parent, dir_name, &iabuf);
|
|
|
cb8e9e |
if (inode == NULL) {
|
|
|
cb8e9e |
+ *op_errno = ESTALE;
|
|
|
cb8e9e |
ret = -1;
|
|
|
cb8e9e |
goto out;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
diff --git a/xlators/storage/posix/src/posix-handle.h b/xlators/storage/posix/src/posix-handle.h
|
|
|
cb8e9e |
index 356b7b9..76ef854 100644
|
|
|
cb8e9e |
--- a/xlators/storage/posix/src/posix-handle.h
|
|
|
cb8e9e |
+++ b/xlators/storage/posix/src/posix-handle.h
|
|
|
cb8e9e |
@@ -260,7 +260,7 @@ posix_make_ancestryfromgfid (xlator_t *this, char *path, int pathsize,
|
|
|
cb8e9e |
const size_t handle_size,
|
|
|
cb8e9e |
const char *priv_base_path,
|
|
|
cb8e9e |
inode_table_t *table, inode_t **parent,
|
|
|
cb8e9e |
- dict_t *xdata);
|
|
|
cb8e9e |
+ dict_t *xdata, int32_t *op_errno);
|
|
|
cb8e9e |
int
|
|
|
cb8e9e |
posix_handle_path_safe (xlator_t *this, uuid_t gfid, const char *basename,
|
|
|
cb8e9e |
char *buf, size_t len);
|
|
|
cb8e9e |
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
|
|
|
cb8e9e |
index 58f68eb..60acac4 100644
|
|
|
cb8e9e |
--- a/xlators/storage/posix/src/posix.c
|
|
|
cb8e9e |
+++ b/xlators/storage/posix/src/posix.c
|
|
|
cb8e9e |
@@ -3482,7 +3482,8 @@ posix_get_ancestry_directory (xlator_t *this, inode_t *leaf_inode,
|
|
|
cb8e9e |
type | POSIX_ANCESTRY_PATH,
|
|
|
cb8e9e |
leaf_inode->gfid,
|
|
|
cb8e9e |
handle_size, priv->base_path,
|
|
|
cb8e9e |
- leaf_inode->table, &inode, xdata);
|
|
|
cb8e9e |
+ leaf_inode->table, &inode, xdata,
|
|
|
cb8e9e |
+ op_errno);
|
|
|
cb8e9e |
if (ret < 0)
|
|
|
cb8e9e |
goto out;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
@@ -3736,7 +3737,7 @@ posix_get_ancestry_non_directory (xlator_t *this, inode_t *leaf_inode,
|
|
|
cb8e9e |
handle_size,
|
|
|
cb8e9e |
priv->base_path,
|
|
|
cb8e9e |
leaf_inode->table,
|
|
|
cb8e9e |
- &parent, xdata);
|
|
|
cb8e9e |
+ &parent, xdata, op_errno);
|
|
|
cb8e9e |
if (op_ret < 0) {
|
|
|
cb8e9e |
goto next;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
--
|
|
|
cb8e9e |
1.7.1
|
|
|
cb8e9e |
|