public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: use btrfs_dev_name() helper to handle missing devices better
Date: Sun, 13 Nov 2022 11:05:35 +0800	[thread overview]
Message-ID: <2cebed11-d454-b2f4-18f2-dcec194600fd@oracle.com> (raw)
In-Reply-To: <071d7f1c5f10d185146b83dd665a68ae5a4c9303.1668303064.git.wqu@suse.com>

On 11/13/22 09:32, Qu Wenruo wrote:
> [BUG]
> If dev-replace failed to re-construct its data/metadata, the kernel
> message would be incorrect for the missing device:
> 
>   BTRFS info (device dm-1): dev_replace from <missing disk> (devid 2) to /dev/mapper/test-scratch2 started
>   BTRFS error (device dm-1): failed to rebuild valid logical 38862848 for dev (efault)
> 
> Note the above "dev (efault)" of the second line.
> While the first line is properly reporting "<missing disk>".
> 
> [CAUSE]
> Although dev-replace is using btrfs_dev_name(), the heavy lifting work
> is still done by scrub (scrub is reused by both dev-replace and regular
> scrub).
> 
> Unfortunately scrub code never uses btrfs_dev_name() helper, as it's
> only declared locally inside dev-replace.c.
> 
> [FIX]
> Fix the output by:
> 
> - Move the btrfs_dev_name() helper to volumes.h
> 
> - Use btrfs_dev_name() to replace open-coded rcu_str_defref() calls
>    Only zoned code is not touched, as I'm not familiar with degraded
>    zoned code.
> 
> Now the output looks pretty sane:
> 
>   BTRFS info (device dm-1): dev_replace from <missing disk> (devid 2) to /dev/mapper/test-scratch2 started
>   BTRFS error (device dm-1): failed to rebuild valid logical 38862848 for dev <missing disk>
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>

Reviewed-by: Anand Jain <anand.jain@oracle.com>



  reply	other threads:[~2022-11-13  3:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-13  1:32 [PATCH] btrfs: use btrfs_dev_name() helper to handle missing devices better Qu Wenruo
2022-11-13  3:05 ` Anand Jain [this message]
2022-11-14 19:30 ` David Sterba

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=2cebed11-d454-b2f4-18f2-dcec194600fd@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.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