TS-2138 TS-2412: fix the bug that cache data loss when restarting ats if build with linuat native-aio.
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/69d04896 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/69d04896 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/69d04896 Branch: refs/heads/5.0.x Commit: 69d04896ef98ee4f565151fe5b1de6f5328fb5df Parents: 7af657e Author: weijin <[email protected]> Authored: Tue Jan 14 10:25:35 2014 +0800 Committer: weijin <[email protected]> Committed: Tue Jan 14 10:28:18 2014 +0800 ---------------------------------------------------------------------- CHANGES | 3 +++ iocore/aio/AIO.cc | 6 ++---- iocore/aio/I_AIO.h | 32 +++++++++++++++++--------------- iocore/aio/P_AIO.h | 2 +- 4 files changed, 23 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/69d04896/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index f5e4224..d880ede 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache Traffic Server 4.2.0 + *) [TS-2412] fix the bug of restarting ATS causes complete cache data + loss when use linux-native-aio. + *) [TS-2488] enhance esi plugin to allow any of the space characters to follow esi starting tags. Author: Yu Qing <[email protected]> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/69d04896/iocore/aio/AIO.cc ---------------------------------------------------------------------- diff --git a/iocore/aio/AIO.cc b/iocore/aio/AIO.cc index ac8ea0f..d933130 100644 --- a/iocore/aio/AIO.cc +++ b/iocore/aio/AIO.cc @@ -635,8 +635,7 @@ ink_aio_readv(AIOCallback *op, int /* fromAPI ATS_UNUSED */) { if (sz > 1) { ink_assert(op->action.continuation); - AIOVec *vec = new AIOVec(sz, op->action.continuation); - vec->action = op->action.continuation; + AIOVec *vec = new AIOVec(sz, op); while (--sz >= 0) { op->action = vec; op = op->then; @@ -662,8 +661,7 @@ ink_aio_writev(AIOCallback *op, int /* fromAPI ATS_UNUSED */) { if (sz > 1) { ink_assert(op->action.continuation); - AIOVec *vec = new AIOVec(sz, op->action.continuation); - vec->action = op->action.continuation; + AIOVec *vec = new AIOVec(sz, op); while (--sz >= 0) { op->action = vec; op = op->then; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/69d04896/iocore/aio/I_AIO.h ---------------------------------------------------------------------- diff --git a/iocore/aio/I_AIO.h b/iocore/aio/I_AIO.h index 00af2b3..83f9bf5 100644 --- a/iocore/aio/I_AIO.h +++ b/iocore/aio/I_AIO.h @@ -71,21 +71,6 @@ typedef struct io_event ink_io_event_t; #define aio_offset u.c.offset #define aio_buf u.c.buf -struct AIOVec: public Continuation -{ - Action action; - int size; - int completed; - - AIOVec(int sz, Continuation *c): Continuation(new_ProxyMutex()), size(sz), completed(0) - { - action = c; - SET_HANDLER(&AIOVec::mainEvent); - } - - int mainEvent(int event, Event *e); -}; - #else typedef struct ink_aiocb @@ -129,6 +114,23 @@ struct AIOCallback: public Continuation }; #if AIO_MODE == AIO_MODE_NATIVE + +struct AIOVec: public Continuation +{ + Action action; + int size; + int completed; + AIOCallback *first; + + AIOVec(int sz, AIOCallback *c): Continuation(new_ProxyMutex()), size(sz), completed(0), first(c) + { + action = c->action; + SET_HANDLER(&AIOVec::mainEvent); + } + + int mainEvent(int event, Event *e); +}; + struct DiskHandler: public Continuation { Event *trigger_event; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/69d04896/iocore/aio/P_AIO.h ---------------------------------------------------------------------- diff --git a/iocore/aio/P_AIO.h b/iocore/aio/P_AIO.h index fe91132..0c2cb99 100644 --- a/iocore/aio/P_AIO.h +++ b/iocore/aio/P_AIO.h @@ -85,7 +85,7 @@ AIOVec::mainEvent(int /* event */, Event *) { else if (completed == size) { MUTEX_LOCK(lock, action.mutex, this_ethread()); if (!action.cancelled) - action.continuation->handleEvent(AIO_EVENT_DONE, this); + action.continuation->handleEvent(AIO_EVENT_DONE, first); delete this; return EVENT_DONE; }
