summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorAnoop C S <anoopcs@redhat.com>2016-03-17 22:44:12 +0530
committerJeff Darcy <jdarcy@redhat.com>2016-03-18 13:19:29 -0700
commit7b8e82f80942b862f30d3fb72c7eecb23fcae226 (patch)
tree76b700398d0d9a571c77f13b7ac2eef20349bd33 /xlators
parent857bad73b3313c895c736faa9a5ec71d046a3da7 (diff)
features/trash: Handle unexpected errors during mkdir
When expected directory hierarchy in not present in trash directory, trash translator tries to create it inside the same. Any errors from posix other than the expected ones should be handled properly during an internal mkdir call and logged accordingly explaining the reason for not moving the file to trash directory. Change-Id: I4e19637138ea4fb92f9301be372ac19542a6aed8 BUG: 1318757 Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-on: http://review.gluster.org/13771 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/trash/src/trash.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/xlators/features/trash/src/trash.c b/xlators/features/trash/src/trash.c
index 1381e8b049d..4b0e6741d9a 100644
--- a/xlators/features/trash/src/trash.c
+++ b/xlators/features/trash/src/trash.c
@@ -669,6 +669,17 @@ trash_unlink_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
}
+ if ((op_ret == -1) && (op_errno != EEXIST)) {
+ gf_log (this->name, GF_LOG_ERROR, "Directory creation failed [%s]. "
+ "Therefore unlinking %s without moving to trash "
+ "directory", strerror(op_errno), local->loc.name);
+ STACK_WIND (frame, trash_common_unwind_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->unlink, &local->loc, 0,
+ xdata);
+ goto out;
+ }
+
LOCK (&frame->lock);
{
loop_count = ++local->loop_count;
@@ -1456,6 +1467,18 @@ trash_truncate_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
}
+ if ((op_ret == -1) && (op_errno != EEXIST)) {
+ gf_log (this->name, GF_LOG_ERROR, "Directory creation failed [%s]. "
+ "Therefore truncating %s without moving the "
+ "original copy to trash directory",
+ strerror(op_errno), local->loc.name);
+ STACK_WIND (frame, trash_common_unwind_buf_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->truncate, &local->loc,
+ local->fop_offset, xdata);
+ goto out;
+ }
+
LOCK (&frame->lock);
{
loop_count = ++local->loop_count;