mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Li zeming <zeming@nfschina.com>,
	clm@fb.com, josef@toxicpanda.com, dsterba@suse.com,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] btrfs: volumes: Increase bioc pointer check
Date: Tue, 25 Oct 2022 19:17:10 +0800	[thread overview]
Message-ID: <9b69ccd1-2fa2-512f-a3ab-d9a8cf723350@gmx.com> (raw)
In-Reply-To: <20221025105244.5212-1-zeming@nfschina.com>



On 2022/10/25 18:52, Li zeming wrote:
> This patch has the following changes:
> 1. Modify "is returned" in the comments to "should be returned".
> 2. Remove the __GFP_NOFAIL flag from the kzalloc function, which returns
> NULL if kzalloc fails to allocate memory for bioc.

Firstly this part should be in change log, not commit message.

You can just do a search in the mail list and see how we handle patches
with newer versions.

Secondly, you didn't mention why we can remove the __GFP_NOFAIL flag at all.

The commit message should look like this instead:

```
Currently we allocate memory for btrfs_io_context using
(GFP_NOFS|__GFP_NOFAIL) in alloc_btrfs_io_context().

But there is nothing special for that function to require NOFAIL flag.

Furthermore the only caller of alloc_btrfs_io_context() is already
handling the ENOMEM error properly.

Thus we can safely remove the __GFP_NOFAIL flag, and handle allocation
failure properly.
```
>
> Reviewed-by: Qu Wenruo <wqu@suse.com>

I'd say, please don't add my tag until everything is fine.
I did a wrong expectation.

Thanks,
Qu

> Signed-off-by: Li zeming <zeming@nfschina.com>
> ---
>   v2: Add annotation vocabulary modify, remove __GFP_NOFAIL flag.
>
>   fs/btrfs/volumes.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 064ab2a79c80..b8d901f58995 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -5891,7 +5891,9 @@ static struct btrfs_io_context *alloc_btrfs_io_context(struct btrfs_fs_info *fs_
>   		 * and the stripes.
>   		 */
>   		sizeof(u64) * (total_stripes),
> -		GFP_NOFS|__GFP_NOFAIL);
> +		GFP_NOFS);
> +	if (!bioc)
> +		return NULL;
>
>   	atomic_set(&bioc->error, 0);
>   	refcount_set(&bioc->refs, 1);
> @@ -6071,7 +6073,7 @@ struct btrfs_discard_stripe *btrfs_map_discard(struct btrfs_fs_info *fs_info,
>    * array of stripes.
>    * For READ, it also needs to be supported using the same mirror number.
>    *
> - * If the requested block is not left of the left cursor, EIO is returned. This
> + * If the requested block is not left of the left cursor, EIO should be returned. This
>    * can happen because btrfs_num_copies() returns one more in the dev-replace
>    * case.
>    */

      reply	other threads:[~2022-10-25 11:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-25 10:52 Li zeming
2022-10-25 11:17 ` Qu Wenruo [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=9b69ccd1-2fa2-512f-a3ab-d9a8cf723350@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zeming@nfschina.com \
    /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®