summaryrefslogtreecommitdiffstats
path: root/xlators/performance
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2012-03-07 21:02:16 +0530
committerVijay Bellur <vijay@gluster.com>2012-03-08 19:22:02 -0800
commitbc10ade1cff9d6cd3b3528ec6c845efadc722481 (patch)
treebc3f1b0edf9e96bffd0cd39a56996290673bc73f /xlators/performance
parent204ab142977163f634cbf4ec92be58754225504a (diff)
performance/io-cache: pass appropriate op_errno even during successful
reads. An op_errno equal to ENOENT with op_ret equal to zero is used by storage/posix xlator to indicate EOF. NFS relies on this protocol for correct functioning. Change-Id: I136fbf429a829bd7bd75ce8ce236f9557a418a5d BUG: 795789 Signed-off-by: Raghavendra G <raghavendra@gluster.com> Reviewed-on: http://review.gluster.com/2894 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/performance')
-rw-r--r--xlators/performance/io-cache/src/io-cache.c7
-rw-r--r--xlators/performance/io-cache/src/io-cache.h4
-rw-r--r--xlators/performance/io-cache/src/ioc-inode.c3
-rw-r--r--xlators/performance/io-cache/src/page.c18
4 files changed, 21 insertions, 11 deletions
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c
index 823bac38d48..3296682303d 100644
--- a/xlators/performance/io-cache/src/io-cache.c
+++ b/xlators/performance/io-cache/src/io-cache.c
@@ -999,7 +999,7 @@ ioc_dispatch_requests (call_frame_t *frame, ioc_inode_t *ioc_inode, fd_t *fd,
"cache hit for trav_offset=%"
PRId64"/local_offset=%"PRId64"",
trav_offset, local_offset);
- waitq = __ioc_page_wakeup (trav);
+ waitq = __ioc_page_wakeup (trav, 0);
} else {
/* if waitq already exists, fstat
* revalidate is
@@ -1016,7 +1016,8 @@ ioc_dispatch_requests (call_frame_t *frame, ioc_inode_t *ioc_inode, fd_t *fd,
local->op_errno = -ret;
need_validate = 0;
- waitq = __ioc_page_wakeup (trav);
+ waitq = __ioc_page_wakeup (trav,
+ 0);
ioc_inode_unlock (ioc_inode);
ioc_waitq_return (waitq);
@@ -1048,7 +1049,7 @@ ioc_dispatch_requests (call_frame_t *frame, ioc_inode_t *ioc_inode, fd_t *fd,
if (ret == -1) {
ioc_inode_lock (ioc_inode);
{
- waitq = __ioc_page_wakeup (trav);
+ waitq = __ioc_page_wakeup (trav, 0);
}
ioc_inode_unlock (ioc_inode);
diff --git a/xlators/performance/io-cache/src/io-cache.h b/xlators/performance/io-cache/src/io-cache.h
index eec24f143ba..bd60aa4f447 100644
--- a/xlators/performance/io-cache/src/io-cache.h
+++ b/xlators/performance/io-cache/src/io-cache.h
@@ -212,7 +212,7 @@ __ioc_wait_on_page (ioc_page_t *page, call_frame_t *frame, off_t offset,
size_t size);
ioc_waitq_t *
-__ioc_page_wakeup (ioc_page_t *page);
+__ioc_page_wakeup (ioc_page_t *page, int32_t op_errno);
void
ioc_page_flush (ioc_page_t *page);
@@ -228,7 +228,7 @@ ioc_waitq_return (ioc_waitq_t *waitq);
int32_t
ioc_frame_fill (ioc_page_t *page, call_frame_t *frame, off_t offset,
- size_t size);
+ size_t size, int32_t op_errno);
#define ioc_inode_lock(ioc_inode) \
do { \
diff --git a/xlators/performance/io-cache/src/ioc-inode.c b/xlators/performance/io-cache/src/ioc-inode.c
index 4c48c41d1b7..a99d5ea99e9 100644
--- a/xlators/performance/io-cache/src/ioc-inode.c
+++ b/xlators/performance/io-cache/src/ioc-inode.c
@@ -123,7 +123,8 @@ ioc_inode_wakeup (call_frame_t *frame, ioc_inode_t *ioc_inode,
ioc_inode_lock (ioc_inode);
{
page_waitq =
- __ioc_page_wakeup (waiter_page);
+ __ioc_page_wakeup (waiter_page,
+ 0);
}
ioc_inode_unlock (ioc_inode);
if (page_waitq)
diff --git a/xlators/performance/io-cache/src/page.c b/xlators/performance/io-cache/src/page.c
index 87a78ecda20..d3d74653a5c 100644
--- a/xlators/performance/io-cache/src/page.c
+++ b/xlators/performance/io-cache/src/page.c
@@ -524,7 +524,8 @@ ioc_fault_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
/* wake up all the frames waiting on
* this page, including
* the frame which triggered fault */
- waitq = __ioc_page_wakeup (page);
+ waitq = __ioc_page_wakeup (page,
+ op_errno);
} /* if(page->waitq) */
} /* if(!page)...else */
} /* if(op_ret < 0)...else */
@@ -650,7 +651,7 @@ err:
int32_t
__ioc_frame_fill (ioc_page_t *page, call_frame_t *frame, off_t offset,
- size_t size)
+ size_t size, int32_t op_errno)
{
ioc_local_t *local = NULL;
ioc_fill_t *fill = NULL;
@@ -685,7 +686,13 @@ __ioc_frame_fill (ioc_page_t *page, call_frame_t *frame, off_t offset,
/* immediately move this page to the end of the page_lru list */
list_move_tail (&page->page_lru, &ioc_inode->cache.page_lru);
/* fill local->pending_size bytes from local->pending_offset */
- if (local->op_ret != -1 && page->size) {
+ if (local->op_ret != -1) {
+ local->op_errno = op_errno;
+
+ if (page->size == 0) {
+ goto done;
+ }
+
if (offset > page->offset)
/* offset is offset in file, convert it to offset in
* page */
@@ -778,6 +785,7 @@ __ioc_frame_fill (ioc_page_t *page, call_frame_t *frame, off_t offset,
local->op_ret += copy_size;
}
+done:
ret = 0;
out:
return ret;
@@ -922,7 +930,7 @@ ioc_frame_return (call_frame_t *frame)
* to be called only when a frame is waiting on an in-transit page
*/
ioc_waitq_t *
-__ioc_page_wakeup (ioc_page_t *page)
+__ioc_page_wakeup (ioc_page_t *page, int32_t op_errno)
{
ioc_waitq_t *waitq = NULL, *trav = NULL;
call_frame_t *frame = NULL;
@@ -941,7 +949,7 @@ __ioc_page_wakeup (ioc_page_t *page)
for (trav = waitq; trav; trav = trav->next) {
frame = trav->data;
ret = __ioc_frame_fill (page, frame, trav->pending_offset,
- trav->pending_size);
+ trav->pending_size, op_errno);
if (ret == -1) {
break;
}