summaryrefslogtreecommitdiffstats
path: root/xlators/performance/write-behind/src/write-behind.c
diff options
context:
space:
mode:
authorvinayak hegde <vinayak@gluster.com>2009-10-15 00:27:14 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-10-15 09:30:53 -0700
commitccb0f6fa67c148545e536d1033abe1652520bdb3 (patch)
treecb0c92fa9ef25a9c64ac908695059d01ee460d56 /xlators/performance/write-behind/src/write-behind.c
parent8b048b48b6925d0f774875abe5cdfccf4b26a868 (diff)
performance/write-behind: In wb_setattr, inode is checked twice
1. check for is it a directory, 2. otherwise check for inode and continue. Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 310 (While trying to create a file on replicate with write behind set-up, client crashes.) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=310
Diffstat (limited to 'xlators/performance/write-behind/src/write-behind.c')
-rw-r--r--xlators/performance/write-behind/src/write-behind.c37
1 files changed, 10 insertions, 27 deletions
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c
index 0ea1ee328fa..cd38f00b394 100644
--- a/xlators/performance/write-behind/src/write-behind.c
+++ b/xlators/performance/write-behind/src/write-behind.c
@@ -1127,33 +1127,7 @@ wb_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
wb_request_t *request = NULL;
int32_t ret = -1, op_errno = EINVAL;
- if (loc->inode)
- {
- /*
- FIXME: fd_lookup extends life of fd till the execution of
- setattr_cbk
- */
- iter_fd = fd_lookup (loc->inode, frame->root->pid);
- if (iter_fd) {
- if (!fd_ctx_get (iter_fd, this, &tmp_file)){
- file = (wb_file_t *)(long)tmp_file;
- } else {
- fd_unref (iter_fd);
- }
- }
- }
-
- local = CALLOC (1, sizeof (*local));
- if (local == NULL) {
- op_errno = ENOMEM;
- goto unwind;
- }
-
- local->file = file;
-
- frame->local = local;
-
- if (!(valid & (GF_SET_ATTR_ATIME | GF_SET_ATTR_MTIME))) {
+ if (!(valid & (GF_SET_ATTR_ATIME | GF_SET_ATTR_MTIME))) {
STACK_WIND (frame,
wb_setattr_cbk,
FIRST_CHILD (this),
@@ -1178,6 +1152,15 @@ wb_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
}
+ local = CALLOC (1, sizeof (*local));
+ if (local == NULL) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ local->file = file;
+
+ frame->local = local;
if (file) {
stub = fop_setattr_stub (frame, wb_setattr_helper, loc, stbuf, valid);