Re: [PATCH 01/11, RESEND] btrfs-progs: root_item generation_v2 is out of sync after btrfsck

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/15/13 1:38 AM, Anand Jain wrote:
> reproducing steps:
> mkfs.btrfs /dev/dm-2 -f
> mount /dev/dm-2 /btrfs
> umount /btrfs
> btrfs check /dev/dm-2 --repair
> mount /dev/dm-2 /btrfs
> 
> ----
> btrfs: mismatching generation and generation_v2 found in root item. This root was probably mounted with an older kernel. Resetting all new fields.
> ----

After this patch (on the integration branch), I'm getting:

[61371.570449] btrfs: mismatching generation and generation_v2 found in root item. This root was probably mounted with an older kernel. Resetting all new fields.

when I run xfstests on my box...

Reverting to an older mkfs.btrfs makes it go away.

-Eric

> btrfs-debug-tree shows change in uuid
> 
> < 		root data bytenr 29425664 level 0 dirid 0 refs 1 gen 43
> < 		uuid 293596e8-7888-eb4c-9134-6df9db996fe5
> 
> Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx>
> ---
>  root-tree.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/root-tree.c b/root-tree.c
> index c10d068..4454147 100644
> --- a/root-tree.c
> +++ b/root-tree.c
> @@ -69,6 +69,7 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root
>  	int ret;
>  	int slot;
>  	unsigned long ptr;
> +	u32 old_size;
>  
>  	path = btrfs_alloc_path();
>  	BUG_ON(!path);
> @@ -79,6 +80,18 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root
>  	l = path->nodes[0];
>  	slot = path->slots[0];
>  	ptr = btrfs_item_ptr_offset(l, slot);
> +	/*
> +	* If the btrfs-progs is newer and kernel is at
> +	* generation_v1 then we don't touch v2 items
> +	* otherwise when kernel is at same or greater
> +	* version compared with btrfs-progs then update
> +	* the needed
> +	*/
> +	old_size = btrfs_item_size_nr(l, slot);
> +	if (old_size >= sizeof(*item)) {
> +		btrfs_set_root_generation_v2(item,
> +			btrfs_root_generation(item));
> +	}
>  	write_extent_buffer(l, item, ptr, sizeof(*item));
>  	btrfs_mark_buffer_dirty(path->nodes[0]);
>  out:
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux