[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c6fd70dd-2b0b-ea9f-f0f8-9d727cde2718@linux.alibaba.com>
Date: Wed, 24 Aug 2022 19:33:31 +0800
From: JeffleXu <jefflexu@...ux.alibaba.com>
To: David Howells <dhowells@...hat.com>, Sun Ke <sunke32@...wei.com>
Cc: linux-cachefs@...hat.com, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v3] cachefiles: fix error return code in
cachefiles_ondemand_copen()
Hi David,
On 8/24/22 6:19 PM, David Howells wrote:
> /* fail OPEN request if copen format is invalid */
> ret = kstrtol(psize, 0, &size);
> if (ret) {
> req->error = ret;
> goto out;
> }
>
> /* fail OPEN request if daemon reports an error */
> if (size < 0) {
> if (!IS_ERR_VALUE(size))
> ret = size = -EINVAL;
> req->error = size;
> goto out;
> }
>
> Should ret get set to the error in size?
The user daemon completes the OPEN request by replying with the "copen"
command. The format of "copen" is like: "copen <id>,<cache_size>",
where <cache_size> specifies the size of the backing file. Besides,
<cache_size> is also reused for specifying the error code when the user
daemon thinks it should fail the OPEN request. In this case, the OPEN
request will fail, while the copen command (i.e.
cachefiles_ondemand_copen()) shall return 0, since the format of the
input "copen" command has no problem at all. After all, the error code
inside <cache_size> is specified by the user daemon itself, and the fact
that the OPEN request will fail totally lies in the expectation of the
user daemon.
On the other hand, cachefiles_ondemand_copen() needs to return error
code when the user daemon specifies the "copen" command in a wrong
format, e.g. specifying an invalid error code in <cache_size>. This is
exactly what this patch fixes.
--
Thanks,
Jingbo
Powered by blists - more mailing lists