public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* btrfs-progs 4.1-rc1: btrfstune -u reporting incorrect current fsid?
@ 2015-06-17 21:21 Mike Fleetwood
  2015-06-18 17:33 ` David Sterba
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Fleetwood @ 2015-06-17 21:21 UTC (permalink / raw)
  To: linux-btrfs

Hi,

I've done a quick test on changing the UUID of a btrfs.  It worked, but
btrfstune -u didn't print the same current uuid that btrfs fi sh does.
It also upper cases the UUID where as btrfs fi sh and blkid don't.

Thanks,
Mike

# btrfs filesystem show /dev/sdb1 | fgrep uuid
Label: none  uuid: b2813976-4d8b-4976-9d59-cbfbd588399c

# ~fedora/programming/c/btrfs-progs-unstable/btrfstune -f -u /dev/sdb1
Current fsid: FFFFFFFF-0000-0000-00B0-8F12937F0000
New fsid: D294F3F3-F2B7-4407-B83A-DE5A4F8CBAB1
Set superblock flag CHANGING_FSID
Change fsid in extents
Change fsid on devices
Clear superblock flag CHANGING_FSID
Fsid change finished

# btrfs filesystem show /dev/sdb1 | fgrep uuid
Label: none  uuid: d294f3f3-f2b7-4407-b83a-de5a4f8cbab1

# blkid | fgrep sdb1
/dev/sdb1: UUID="d294f3f3-f2b7-4407-b83a-de5a4f8cbab1"
UUID_SUB="70065403-5ec1-462c-93a4-26cff8b6aea2" TYPE="btrfs"
PARTUUID="b309c48c-486f-4882-896c-34d4d0aeb529"

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: btrfs-progs 4.1-rc1: btrfstune -u reporting incorrect current fsid?
  2015-06-17 21:21 btrfs-progs 4.1-rc1: btrfstune -u reporting incorrect current fsid? Mike Fleetwood
@ 2015-06-18 17:33 ` David Sterba
  2015-06-19  1:40   ` Qu Wenruo
  0 siblings, 1 reply; 4+ messages in thread
From: David Sterba @ 2015-06-18 17:33 UTC (permalink / raw)
  To: Mike Fleetwood; +Cc: linux-btrfs

On Wed, Jun 17, 2015 at 10:21:45PM +0100, Mike Fleetwood wrote:
> It also upper cases the UUID where as btrfs fi sh and blkid don't.

Ok, I'll switch that to lowercase so it's consistent with the rest.

> I've done a quick test on changing the UUID of a btrfs.  It worked, but
> btrfstune -u didn't print the same current uuid that btrfs fi sh does.

Seems that the reporting is broken in the btrfstune side. I've
reproduced it here. I've used btrfs-show-super in the tests and did not
notice that the 'current fsid' is wrong. Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: btrfs-progs 4.1-rc1: btrfstune -u reporting incorrect current fsid?
  2015-06-18 17:33 ` David Sterba
@ 2015-06-19  1:40   ` Qu Wenruo
  2015-06-19 10:26     ` David Sterba
  0 siblings, 1 reply; 4+ messages in thread
From: Qu Wenruo @ 2015-06-19  1:40 UTC (permalink / raw)
  To: dsterba, Mike Fleetwood, linux-btrfs



David Sterba wrote on 2015/06/18 19:33 +0200:
> On Wed, Jun 17, 2015 at 10:21:45PM +0100, Mike Fleetwood wrote:
>> It also upper cases the UUID where as btrfs fi sh and blkid don't.
>
> Ok, I'll switch that to lowercase so it's consistent with the rest.
>
>> I've done a quick test on changing the UUID of a btrfs.  It worked, but
>> btrfstune -u didn't print the same current uuid that btrfs fi sh does.
>
> Seems that the reporting is broken in the btrfstune side. I've
> reproduced it here. I've used btrfs-show-super in the tests and did not
> notice that the 'current fsid' is wrong. Thanks.

Just a little tip to take less time on the bug:
---
--- a/btrfstune.c
+++ b/btrfstune.c
@@ -349,7 +349,7 @@ static int change_uuid(struct btrfs_fs_info 
*fs_info, const char *new_fsid_str)
         fs_info->new_fsid = new_fsid;
         fs_info->new_chunk_tree_uuid = new_chunk_id;

-       uuid_parse((const char*)fs_info->fsid, old_fsid);
+       memcpy(old_fsid, fs_info->fsid, BTRFS_UUID_SIZE);
         uuid_unparse_upper(old_fsid, uuid_buf);
         printf("Current fsid: %s\n", uuid_buf);

---

Also, you can remove the old_fsid variant if you want and just use 
fs_info->fsid.

Thanks,
Qu

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: btrfs-progs 4.1-rc1: btrfstune -u reporting incorrect current fsid?
  2015-06-19  1:40   ` Qu Wenruo
@ 2015-06-19 10:26     ` David Sterba
  0 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2015-06-19 10:26 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: Mike Fleetwood, linux-btrfs

On Fri, Jun 19, 2015 at 09:40:37AM +0800, Qu Wenruo wrote:
> Just a little tip to take less time on the bug:
> -       uuid_parse((const char*)fs_info->fsid, old_fsid);
> +       memcpy(old_fsid, fs_info->fsid, BTRFS_UUID_SIZE);

Thanks, that's what I did.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-19 10:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-17 21:21 btrfs-progs 4.1-rc1: btrfstune -u reporting incorrect current fsid? Mike Fleetwood
2015-06-18 17:33 ` David Sterba
2015-06-19  1:40   ` Qu Wenruo
2015-06-19 10:26     ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox