diff options
Diffstat (limited to 'xlators/performance/read-ahead/src')
-rw-r--r-- | xlators/performance/read-ahead/src/read-ahead.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/xlators/performance/read-ahead/src/read-ahead.c b/xlators/performance/read-ahead/src/read-ahead.c index 1b37cace3..2ffb4ad6b 100644 --- a/xlators/performance/read-ahead/src/read-ahead.c +++ b/xlators/performance/read-ahead/src/read-ahead.c @@ -64,7 +64,6 @@ ra_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto unwind; } - ret = fd_ctx_set (fd, this, (uint64_t)(long)file); /* If mandatory locking has been enabled on this file, we disable caching on it */ @@ -102,6 +101,12 @@ ra_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, file->page_count = 1; } + ret = fd_ctx_set (fd, this, (uint64_t)(long)file); + if (ret == -1) { + ra_file_destroy (file); + op_ret = -1; + op_errno = ENOMEM; + } unwind: STACK_UNWIND (frame, op_ret, op_errno, fd); @@ -133,8 +138,6 @@ ra_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto unwind; } - ret = fd_ctx_set (fd, this, (uint64_t)(long)file); - /* If mandatory locking has been enabled on this file, we disable caching on it */ @@ -168,6 +171,13 @@ ra_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, file->page_size = conf->page_size; pthread_mutex_init (&file->file_lock, NULL); + ret = fd_ctx_set (fd, this, (uint64_t)(long)file); + if (ret == -1) { + ra_file_destroy (file); + op_ret = -1; + op_errno = ENOMEM; + } + unwind: STACK_UNWIND (frame, op_ret, op_errno, fd, inode, buf); |