linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH for-4.20 0/3] Fix incorrectly created uuid tree
Date: Thu, 27 Dec 2018 15:13:30 +0800	[thread overview]
Message-ID: <20181227071333.10964-1-wqu@suse.com> (raw)

This patchset can be fetched from github:
https://github.com/adam900710/btrfs-progs/tree/uuid_tree_support
Which is based on v4.19.1 tag.

Commit 2a496a5b8b74 ("btrfs-progs: mkfs: precreate the uuid tree")
creates uuid tree at mkfs time.

However it doesn't populate uuid tree correctly nor just create an empty
root.
It uses create_tree(), which just copies the content of fs root,
containing meaningless INODE_ITEM:

v4.15 mkfs (no uuid tree creation) + kernel mount:
  uuid tree key (UUID_TREE ROOT_ITEM 0)
  leaf 30572544 items 1 free space 16250 generation 7 owner UUID_TREE
  leaf 30572544 flags 0x1(WRITTEN) backref revision 1
  fs uuid 33ecddef-fc86-481a-93ce-846b01c11376
  chunk uuid 9e58f646-b0da-43ca-9c7d-8bbe3e120246
	item 0 key (0x92457c59d31491be UUID_KEY_SUBVOL 0xef908b5e79aa76a1) itemoff 16275 itemsize 8
		subvol_id 5

v4.19.1 mkfs (incorrect one), no kernel mount:
  uuid tree key (UUID_TREE ROOT_ITEM 0)
  leaf 30507008 items 2 free space 16061 generation 4 owner UUID_TREE
  leaf 30507008 flags 0x1(WRITTEN) backref revision 1
  fs uuid 162f5333-9b5d-4217-877c-ddaeaa79398e
  chunk uuid 7bc2c5c6-a6d2-4eec-a513-142b549c6541
	item 0 key (256 INODE_ITEM 0) itemoff 16123 itemsize 160
		generation 3 transid 0 size 0 nbytes 16384
		block group 0 mode 40755 links 1 uid 0 gid 0 rdev 0
		sequence 0 flags 0x0(none)
	item 1 key (256 INODE_REF 256) itemoff 16111 itemsize 12
		index 0 namelen 2 name: ..

This patchset will fix it by populuating uuid tree properly, as kernel
tree checker now doesn't accept empty uuid tree.

w/ this patchset, no kernel mount:
  uuid tree key (UUID_TREE ROOT_ITEM 0)
  leaf 30507008 items 1 free space 16250 generation 4 owner UUID_TREE
  leaf 30507008 flags 0x1(WRITTEN) backref revision 1
  fs uuid ae53079e-dbbc-409b-a565-5326c7b27731
  chunk uuid b5fb1bea-f20d-4af1-80f8-6ca3f0038d67
	item 0 key (0x334ba6b032d89c07 UUID_KEY_SUBVOL 0x86cde09cb78bcca0) itemoff 16275 itemsize 8
		subvol_id 5

Qu Wenruo (3):
  btrfs-progs: uuid: Port kernel btrfs_uuid_tree_lookup()
  btrfs-progs: uuid: Port btrfs_uuid_tree_add() function
  btrfs-progs: Create uuid tree with proper contents

 ctree.h       |   7 ++-
 disk-io.c     |   4 ++
 mkfs/common.c | 103 ++++++++++++++++++++++++++++++++++++++
 mkfs/common.h |   3 ++
 mkfs/main.c   |  36 +------------
 uuid-tree.c   | 136 +++++++++++++++++++++++++++++++++++++++++++++++++-
 6 files changed, 252 insertions(+), 37 deletions(-)

-- 
2.20.1


             reply	other threads:[~2018-12-27  7:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-27  7:13 Qu Wenruo [this message]
2018-12-27  7:13 ` [PATCH 1/3] btrfs-progs: uuid: Port kernel btrfs_uuid_tree_lookup() Qu Wenruo
2018-12-27  7:37   ` Su Yue
2018-12-27  7:31     ` Qu Wenruo
2018-12-27  7:13 ` [PATCH 2/3] btrfs-progs: uuid: Port btrfs_uuid_tree_add() function Qu Wenruo
2018-12-27  7:54   ` Su Yue
2018-12-27  7:13 ` [PATCH 3/3] btrfs-progs: Create uuid tree with proper contents Qu Wenruo
2018-12-27 11:28   ` Su Yue
2018-12-27 11:32     ` Qu Wenruo
2019-01-02 16:31     ` David Sterba
2019-01-02 23:46       ` Su Yue
2019-01-02  9:13   ` Nikolay Borisov
2019-01-02 10:00     ` Qu Wenruo
2019-01-02 10:07       ` Nikolay Borisov
2019-01-02 10:11         ` Qu Wenruo
2019-01-03  4:50       ` 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=20181227071333.10964-1-wqu@suse.com \
    --to=wqu@suse.com \
    --cc=linux-btrfs@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;
as well as URLs for NNTP newsgroup(s).