fix epoll_ctl EBADF exception
fix epoll_ctl EBADF exception

* Problem:
  Current epoll version of IOManager do the event in following sequence:
   1. epoll_wait() to get fd events
   2. check events and trigger corresponding events
   3. epoll_ctl() to modify or delete the event fd
  This sequence has the problem that the event fd can't be guaranteed to
  be valid in step 3 because of step 2.
* Solution:
  change the executing sequence to:
   1. epoll_wait()
   2. epoll_ctl()
   3. trigger corresponding events
  (This is also the pattern of kevent implementation)
* reference: https://redmine.dechocorp.com/issues/80896
* fix the events might not be triggered due to shortcut of `||' operation

Change-Id: I78114ea8f3ddb1560790f61cfa2df85c5ad66c61
Signed-off-by: Kevin Cai <7771192b74080b0349ce1991a9eaaeec64bf9e00@vmware.com>
Reviewed-on: https://gerrit.dechocorp.com/33754
Reviewed-by: Jenkins <49695b0f9c673fd73dab0ff3f84b5ced9302cc6a@mozy.com>
Reviewed-by: Kefu Chai <a4b264ee037c625052534d60505bfd0db4776ac4@vmware.com>
Reviewed-by: Andrew Skowronski <96924f7a4dbe24093bb2da18f50a76703cb4a362@mozy.com>

mozy/mordor,adfin/mordor,mtanski/mordor,mtanski/mordor,mozy/mordor,mtanski/mordor,adfin/mordor,adfin/mordor,mozy/mordor