Re: [PATCH V2 3/5] cachefiles: resend an open request if the read request's object is closed

From: JeffleXu
Date: Fri Oct 14 2022 - 02:31:59 EST




On 10/14/22 11:07 AM, Jia Zhu wrote:

> +/*
> + * Reopen the closed object with associated read request.

I think "Reopen the closed object if there's any inflight or subsequent
READ request on this object" would be better?

> + * Skip read requests whose related object are reopening.
^
is ?


> @@ -277,14 +308,18 @@ ssize_t cachefiles_ondemand_daemon_read(struct cachefiles_cache *cache,
> xa_unlock(&cache->reqs);
>
> id = xas.xa_index;
> - msg->msg_id = id;
>
> if (msg->opcode == CACHEFILES_OP_OPEN) {
> ret = cachefiles_ondemand_get_fd(req);
> - if (ret)
> + if (ret) {
> + cachefiles_ondemand_set_object_close(req->object);
> goto error;
> + }
> }
>
> + msg->msg_id = id;
> + msg->object_id = req->object->private->ondemand_id;

Since currently msg->object_id is always assigned in
cachefiles_ondemand_daemon_read(), we can remove the assignment in
cachefiles_ondemand_get_fd().


Otherwise LGTM.

Reviewed-by: Jingbo Xu <jefflexu@xxxxxxxxxxxxxxxxx>

--
Thanks,
Jingbo