[PATCH 0/5] cachefiles: some bugfixes for clean object/send req/poll

From: libaokun
Date: Tue Apr 23 2024 - 23:43:35 EST


From: Baokun Li <libaokun1@xxxxxxxxxx>

Hello everyone!

Recently we found some bugs while doing tests on cachefiles ondemand mode,
and this patchset is a fix for some of those issues. The following is a
brief overview of the patches, see the patches for more details.

Patch 1-3: After an object has been cleaned up, make sure it has no
outstanding requests and that the corresponding ondemand_object_worker
has exited, otherwise it may use-after-free.

Patch 4: Cyclic allocation of msg_id to avoid msg_id reuse misleading
the daemon to cause hung.

Patch 5: Hold xas_lock during polling to avoid dereferencing reqs causing
use-after-free.

Comments and questions are, as always, welcome.

Thanks,
Baokun

Baokun Li (3):
cachefiles: stop sending new request when dropping object
cachefiles: flush all requests for the object that is being dropped
cachefiles: cyclic allocation of msg_id to avoid reuse

Hou Tao (1):
cachefiles: flush ondemand_object_worker during clean object

Jingbo Xu (1):
cachefiles: add missing lock protection when polling

fs/cachefiles/daemon.c | 4 +-
fs/cachefiles/internal.h | 3 +
fs/cachefiles/ondemand.c | 120 ++++++++++++++++++++++++++-------------
3 files changed, 86 insertions(+), 41 deletions(-)

--
2.39.2