summaryrefslogtreecommitdiffstats
path: root/xlators/performance
diff options
context:
space:
mode:
authorvinayak hegde <vinayak@gluster.com>2009-10-12 23:38:41 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-10-13 04:53:18 -0700
commitbabdbcbb6a434d65b0fdd9df708e94bea13cf05d (patch)
tree3cbf758a88db38d04fc56d76d3146ebb4382b56b /xlators/performance
parente84a3cf74947d7a6deace07a1726376aa0a8a6a4 (diff)
performance/write-behind: In wb_setattr file is used before getting fd context
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')
-rw-r--r--xlators/performance/write-behind/src/write-behind.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c
index 5fbe1c06601..ef460b1123e 100644
--- a/xlators/performance/write-behind/src/write-behind.c
+++ b/xlators/performance/write-behind/src/write-behind.c
@@ -1126,7 +1126,23 @@ wb_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
wb_request_t *request = NULL;
int32_t ret = -1, op_errno = EINVAL;
- local = CALLOC (1, sizeof (*local));
+ 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;