mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sun Ke <sunke32@huawei.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	JeffleXu <jefflexu@linux.alibaba.com>,
	<kernel-janitors@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-cachefs@redhat.com>, <linux-fsdevel@vger.kernel.org>
Subject: Re: [Linux-cachefs] [PATCH v3] cachefiles: fix error return code in cachefiles_ondemand_copen()
Date: Fri, 26 Aug 2022 09:11:34 +0800	[thread overview]
Message-ID: <a9e7f60a-61a6-bceb-2f5a-07438f7bb8e8@huawei.com> (raw)
In-Reply-To: <YweAGTuBw1hWm8PW@B-P7TQMD6M-0146.local>



在 2022/8/25 21:58, Gao Xiang 写道:
> On Thu, Aug 25, 2022 at 04:36:20PM +0300, Dan Carpenter wrote:
>> I spent a long time looking at this as well...  It's really inscrutable
>> code.  It would be more readable if we just spelled things out in the
>> most pedantic way possible:
>>
> 
> Yeah, the following code looks much better. Ke, would you mind
> sending a version like below instead?

OK, I will update it.
> 
> Thanks,
> Gao Xiang
> 
>> diff --git a/fs/cachefiles/ondemand.c b/fs/cachefiles/ondemand.c
>> index 1fee702d5529..7e1586bd5cf3 100644
>> --- a/fs/cachefiles/ondemand.c
>> +++ b/fs/cachefiles/ondemand.c
>> @@ -158,9 +158,13 @@ int cachefiles_ondemand_copen(struct cachefiles_cache *cache, char *args)
>>   
>>   	/* fail OPEN request if daemon reports an error */
>>   	if (size < 0) {
>> -		if (!IS_ERR_VALUE(size))
>> -			size = -EINVAL;
>> -		req->error = size;
>> +		if (!IS_ERR_VALUE(size)) {
>> +			req->error = -EINVAL;
>> +			ret = -EINVAL;
>> +		} else {
>> +			req->error = size;
>> +			ret = 0;
>> +		}
>>   		goto out;
>>   	}
>>   
>>
>> --
>> Linux-cachefs mailing list
>> Linux-cachefs@redhat.com
>> https://listman.redhat.com/mailman/listinfo/linux-cachefs
> .
> 

      reply	other threads:[~2022-08-26  1:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-18 12:50 Sun Ke
2022-08-19  9:18 ` [Linux-cachefs] " Gao Xiang
2022-08-20  9:22 ` JeffleXu
2022-08-24 10:19 ` David Howells
2022-08-24 11:33   ` JeffleXu
2022-08-25 13:36     ` Dan Carpenter
2022-08-25 13:58       ` [Linux-cachefs] " Gao Xiang
2022-08-26  1:11         ` Sun Ke [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a9e7f60a-61a6-bceb-2f5a-07438f7bb8e8@huawei.com \
    --to=sunke32@huawei.com \
    --cc=dan.carpenter@oracle.com \
    --cc=jefflexu@linux.alibaba.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-cachefs@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®