summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavan Sondur <pavan@gluster.com>2010-02-22 05:35:55 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-02-22 03:40:08 -0800
commit53f7786f307f0d2044ea427daeb3587563877f71 (patch)
tree7f0de6993b1fafa358160d42397d4f875a808c8f
parent7c59c0849e4c54be7473151dd45468c68b957ec4 (diff)
storage/posix: Check for path before logging it in case of an error in xattrop FOP.
Signed-off-by: Pavan Vilas Sondur <pavan@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 614 (GlusterFS crashes while printing error if fsetxattr call fails in posix) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=614
-rw-r--r--xlators/storage/posix/src/posix.c45
1 files changed, 32 insertions, 13 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 8374f408cc2..53949d56030 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -3676,7 +3676,6 @@ do_xattrop (call_frame_t *frame, xlator_t *this,
path = strdup (loc->path);
inode = loc->inode;
} else {
- inode_path (fd->inode, NULL, &path);
inode = fd->inode;
}
@@ -3703,10 +3702,16 @@ do_xattrop (call_frame_t *frame, xlator_t *this,
"Extended attributes not "
"supported by filesystem");
} else {
- gf_log (this->name, GF_LOG_ERROR,
- "getxattr failed on %s while doing "
- "xattrop: %s", path,
- strerror (op_errno));
+ if (loc)
+ gf_log (this->name, GF_LOG_ERROR,
+ "getxattr failed on %s while doing "
+ "xattrop: %s", path,
+ strerror (op_errno));
+ else
+ gf_log (this->name, GF_LOG_ERROR,
+ "fgetxattr failed on fd=%d while doing "
+ "xattrop: %s", _fd,
+ strerror (op_errno));
}
op_ret = -1;
@@ -3746,10 +3751,17 @@ do_xattrop (call_frame_t *frame, xlator_t *this,
op_errno = errno;
if (size == -1) {
- gf_log (this->name, GF_LOG_ERROR,
- "setxattr failed on %s while doing xattrop: "
- "key=%s (%s)", path,
- trav->key, strerror (op_errno));
+ if (loc)
+ gf_log (this->name, GF_LOG_ERROR,
+ "setxattr failed on %s while doing xattrop: "
+ "key=%s (%s)", path,
+ trav->key, strerror (op_errno));
+ else
+ gf_log (this->name, GF_LOG_ERROR,
+ "fsetxattr failed on fd=%d while doing xattrop: "
+ "key=%s (%s)", _fd,
+ trav->key, strerror (op_errno));
+
op_ret = -1;
goto out;
} else {
@@ -3757,10 +3769,17 @@ do_xattrop (call_frame_t *frame, xlator_t *this,
trav->value->len);
if (size != 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "dict_set_bin failed (path=%s): "
- "key=%s (%s)", path,
- trav->key, strerror (-size));
+ if (loc)
+ gf_log (this->name, GF_LOG_DEBUG,
+ "dict_set_bin failed (path=%s): "
+ "key=%s (%s)", path,
+ trav->key, strerror (-size));
+ else
+ gf_log (this->name, GF_LOG_DEBUG,
+ "dict_set_bin failed (fd=%d): "
+ "key=%s (%s)", _fd,
+ trav->key, strerror (-size));
+
op_ret = -1;
op_errno = EINVAL;
goto out;