public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: Filipe Manana <fdmanana@kernel.org>, dsterba@suse.cz
Cc: linux-btrfs@vger.kernel.org, dsterba@suse.com,
	aromosan@gmail.com, bernd.feige@gmx.net,
	CHECK_1234543212345@protonmail.com, stable@vger.kernel.org
Subject: Re: [PATCH v2] btrfs: do not skip re-registration for the mounted device
Date: Thu, 7 Mar 2024 09:43:05 +0530	[thread overview]
Message-ID: <ee9aa0b8-bda1-4217-bb9b-fa9b886d6196@oracle.com> (raw)
In-Reply-To: <CAL3q7H5wx5rKmSzGWP7mRqaSfAY88g=35N4OBrbJB61rK0mt2w@mail.gmail.com>


The problem has been highly inconsistent to reproduce. I apologize
for the delay in sending out the fix.

<snap>

> $ ./check btrfs/14[6-9] btrfs/15[8-9]
> FSTYP         -- btrfs
> PLATFORM      -- Linux/x86_64 debian0 6.8.0-rc5-btrfs-next-151+ #1 SMP
> PREEMPT_DYNAMIC Mon Feb 19 13:38:37 WET 2024
> MKFS_OPTIONS  -- /dev/sdc
> MOUNT_OPTIONS -- /dev/sdc /home/fdmanana/btrfs-tests/scratch_1
> 
> btrfs/146 1s ...  2s
> btrfs/147 0s ...  1s
> btrfs/148 2s ...  2s
> btrfs/149 1s ...  1s
> btrfs/158 1s ...  0s
> btrfs/159 20s ... - output mismatch (see
> /home/fdmanana/git/hub/xfstests/results//btrfs/159.out.bad)
>      --- tests/btrfs/159.out 2020-10-26 15:31:57.061207266 +0000
>      +++ /home/fdmanana/git/hub/xfstests/results//btrfs/159.out.bad
> 2024-02-20 13:51:25.707220763 +0000
>      @@ -1,8 +1,11 @@
>       QA output created by 159
>      +mount: /home/fdmanana/btrfs-tests/scratch_1: wrong fs type, bad
> option, bad superblock on /dev/mapper/flakey-test, missing codepage or
> helper program, or other error.
>      +       dmesg(1) may have more information after failed mount system call.
>       File digest before power failure:
>      -f049865ed45b1991dc9a299b47d51dbf  SCRATCH_MNT/foobar
>      +b2e8facfb4795185fadd85707fe78973  SCRATCH_MNT/foobar
>      +umount: /home/fdmanana/btrfs-tests/scratch_1: not mounted.
>      ...
>      (Run 'diff -u /home/fdmanana/git/hub/xfstests/tests/btrfs/159.out
> /home/fdmanana/git/hub/xfstests/results//btrfs/159.out.bad'  to see
> the entire diff)
> Ran: btrfs/146 btrfs/147 btrfs/148 btrfs/149 btrfs/158 btrfs/159
> 

<snap>

btrfs/159 does

         _scratch_mkfs -O no-holes -n $((64 * 1024)) >>$seqres.full 2>&1
         _require_metadata_journaling $SCRATCH_DEV
         _init_flakey
         _mount_flakey

> [79195.612719] BTRFS: device fsid 10184d7d-3ca9-43c1-a6f8-70b134cff828
> devid 1 transid 6 /dev/sdc scanned by mkfs.btrfs (3413318)
> [79195.666279] BTRFS: device fsid 10184d7d-3ca9-43c1-a6f8-70b134cff828
> devid 1 transid 6 /dev/dm-0 scanned by systemd-udevd (3410982)

Both /dev/sdc and /dev/dm-0 get scanned, and the tempfsid
gets activated wrongly.

The fix is to add another criterion to check if the device is
already mounted; then only let the thread update the device path.
However, I'm not sure if it will fix the original problem
(update-grub). I have sent an RFC patch v3 for verification.

Thanks,  Anand


> [79195.695774] BTRFS info (device dm-0): first mount of filesystem
> 10184d7d-3ca9-43c1-a6f8-70b134cff828
> [79195.695786] BTRFS info (device dm-0): using crc32c (crc32c-intel)
> checksum algorithm
> [79195.695789] BTRFS error (device dm-0): superblock fsid doesn't
> match fsid of fs_devices: 10184d7d-3ca9-43c1-a6f8-70b134cff828 !=
> 628aff33-4122-4d77-b2a9-2e9a90f27520
> [79195.696098] BTRFS error (device dm-0): superblock metadata_uuid
> doesn't match metadata uuid of fs_devices:
> 10184d7d-3ca9-43c1-a6f8-70b134cff828 !=
> 628aff33-4122-4d77-b2a9-2e9a90f27520
> [79195.696419] BTRFS error (device dm-0): dev_item UUID does not match
> metadata fsid: 628aff33-4122-4d77-b2a9-2e9a90f27520 !=
> 10184d7d-3ca9-43c1-a6f8-70b134cff828
> [79195.696765] BTRFS error (device dm-0): superblock contains fatal errors
> [79195.697447] BTRFS error (device dm-0): open_ctree failed
> 
> It always happens with this patch applied in for-next, and never
> happens with it reverted.
> 
>>

      parent reply	other threads:[~2024-03-07  4:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-13  1:13 [PATCH v2] btrfs: do not skip re-registration for the mounted device Anand Jain
2024-02-14  7:16 ` David Sterba
2024-02-20 14:08   ` Filipe Manana
2024-02-20 18:12     ` David Sterba
2024-02-21 16:39       ` Anand Jain
2024-02-21 17:03         ` Anand Jain
2024-02-21 21:49         ` David Sterba
2024-02-22  2:45           ` Anand Jain
2024-02-22 21:07             ` Anand Jain
2024-03-07  4:13     ` Anand Jain [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=ee9aa0b8-bda1-4217-bb9b-fa9b886d6196@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=CHECK_1234543212345@protonmail.com \
    --cc=aromosan@gmail.com \
    --cc=bernd.feige@gmx.net \
    --cc=dsterba@suse.com \
    --cc=dsterba@suse.cz \
    --cc=fdmanana@kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=stable@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