summaryrefslogtreecommitdiffstats
path: root/xlators/features/trash
diff options
context:
space:
mode:
authorAnoop C S <anoopcs@redhat.com>2016-03-17 22:44:12 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-05-03 06:09:56 -0700
commitdd0133fd38232261521fb6a810b9bb6dde4cc5a4 (patch)
tree087eec7cac98d2222f81a1b42e65cc3bfaaf0c02 /xlators/features/trash
parent32101f782552cef7666be7294533c71da821b22c (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 >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> (cherry picked from commit 7b8e82f80942b862f30d3fb72c7eecb23fcae226) Change-Id: I8574f461a4e60491b359685deeadedfb9760366e BUG: 1319380 Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-on: http://review.gluster.org/13783 Smoke: Gluster Build System <jenkins@build.gluster.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
Diffstat (limited to 'xlators/features/trash')
-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 e14edf0eea7..a74716dce15 100644
--- a/xlators/features/trash/src/trash.c
+++ b/xlators/features/trash/src/trash.c
@@ -678,6 +678,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;
@@ -1477,6 +1488,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;