From: Anand Jain <Anand.Jain@oracle.com>
To: Qu Wenruo <quwenruo@cn.fujitsu.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs-progs: Force 'btrfs dev scan' not using old libblkid cache
Date: Thu, 10 Apr 2014 15:37:13 +0800 [thread overview]
Message-ID: <53464A29.7090607@oracle.com> (raw)
In-Reply-To: <1397115021-30426-1-git-send-email-quwenruo@cn.fujitsu.com>
On 04/10/2014 03:30 PM, Qu Wenruo wrote:
> 'btrfs scan' uses libblkid to scan devices by default, and libblkid uses
> cache to reduce the probe.
>
> But if operations below is done in less than 2 seconds(BLKID_PROBE_MIN),
> 'btrfs scan' will still use the uncorrect cache and scan on the deleted device.
Great thanks for looking into this.
Anand
> 0. /dev/sda[1-4] mounted on /mnt using single data/metadata
> 1. btrfs dev scan
> 2. btrfs dev del /dev/sda3 /mnt
> 3. btrfs dev scan
> Since the cache made by step 1 is still validated, step 3 will use the
> cache and consider /dev/sda3 as a btrfs filesystem and try to scan it.
> But the superblock(at least the first one) is wiped and failed to scan,
> a error message, which can be avoided and is unneeded, is output.
>
> This patch will force scan_for_btrfs() not to use cache to avoid the
> problem.
>
> Reported-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
> Singed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
> ---
> utils.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/utils.c b/utils.c
> index 0bfb9d9..1cd1d28 100644
> --- a/utils.c
> +++ b/utils.c
> @@ -2057,7 +2057,8 @@ int btrfs_scan_lblkid(int update_kernel)
> blkid_cache cache = NULL;
> char path[PATH_MAX];
>
> - if (blkid_get_cache(&cache, 0) < 0) {
> + /* No to use libblkid cache to avoid old data */
> + if (blkid_get_cache(&cache, "/dev/null") < 0) {
> printf("ERROR: lblkid cache get failed\n");
> return 1;
> }
>
next prev parent reply other threads:[~2014-04-10 7:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-10 7:30 [PATCH] btrfs-progs: Force 'btrfs dev scan' not using old libblkid cache Qu Wenruo
2014-04-10 7:37 ` Anand Jain [this message]
2014-04-14 16:29 ` David Sterba
2014-04-15 1:17 ` Qu Wenruo
2014-04-16 1:24 ` Qu Wenruo
2014-04-16 2:09 ` Qu Wenruo
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=53464A29.7090607@oracle.com \
--to=anand.jain@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=quwenruo@cn.fujitsu.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;
as well as URLs for NNTP newsgroup(s).