短版的问题:
通过io_submit处理提交IO(使用O_DIRECT打开文件)。当在fs address_space_operations .direct_IO中调用kiocb-> ki_complete(aio_complete_rw)时,一切……
在你的 async_read_work 功能,你打电话 kfree(a_work); ,设定 a_work = NULL; 然后解除引用 a_work 这里: a_work->a_iocb->ki_complete(a_work->a_iocb,100, 0); 。
async_read_work
kfree(a_work);
a_work = NULL;
a_work
a_work->a_iocb->ki_complete(a_work->a_iocb,100, 0);
可能的解决方案:
重新排列代码:
a_work->a_iocb->ki_complete(a_work->a_iocb,100, 0); kfree(a_work); a_work = NULL; /* not really necessary */
使用局部变量:
struct kiocb *iocb; ... iocb = a_work->a_iocb; kfree(a_work); a_work = NULL; /* not really necessary */ iocb->ki_complete(iocb,100, 0);