Whamcloud - gitweb
LU-13900 clio: don't call aio_complete() in lustre upon errors 36/39636/7
authorWang Shilong <wshilong@ddn.com>
Tue, 11 Aug 2020 15:17:46 +0000 (23:17 +0800)
committerOleg Drokin <green@whamcloud.com>
Sat, 19 Sep 2020 14:12:08 +0000 (14:12 +0000)
commit2fb8444b5a636956281f180a04845502e7e99691
tree33cba8d7ab121073bb4351cda6c884a8fe0d2eaa
parent0aa3d883acfb05b899e9a6dfd5247e2edd671d51
LU-13900 clio: don't call aio_complete() in lustre upon errors

See following codes in aio_ret():
"
static inline ssize_t aio_ret(struct kiocb *req, ssize_t ret)
{
        switch (ret) {
        case -EIOCBQUEUED:
                return ret;
        case -ERESTARTSYS:
        case -ERESTARTNOINTR:
        case -ERESTARTNOHAND:
        case -ERESTART_RESTARTBLOCK:
                /*
                 * There's no easy way to restart the
                 * syscall since other AIO's may be already running.
                 * Just fail this IO with EINTR.
                 */
                ret = -EINTR;
                /*FALLTHRU*/
        default:
                aio_complete(req, ret, 0);
                return 0;
        }
}
"
VFS will call aio_complete() if ret is not -EIOCBQUEUED,
this could happen when we don't pass user buffer as page
alignment or some other errors happen in Lustre.

So in Lustre, we need be careful to handle this case to avoid double
aio_complete() called.

Fixes: d1dde ("LU-4198 clio: AIO support for direct IO")
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Change-Id: I2137844437e91a4e269f7584c3a233e5fc81b0df
Reviewed-on: https://review.whamcloud.com/39636
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Yingjin Qian <qian@ddn.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/cl_object.h
lustre/llite/file.c
lustre/obdclass/cl_io.c
lustre/tests/sanity.sh