Skip to contentSkip to conversation

Problem with renaming devices

PATCH Superseded Gustavo Alves 3 participants 5 messages Nov 7, 2009 – Feb 9, 2010 1 message not in the archive Btrfs file system

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi Chris,

I found the same problem on 2.6.32-0.33.rc5.git1 with btrfs-progs 0.19. This problem is already fixed?

Thanks

----
Gustavo Junior Alves
Specchio Solu=E7=F5es em TI
http://specchio.inf.br
Tel: +55 19 9223-0500

Quoted 34 lines

From: Chris Mason <chris.mason_=E4t_oracle.com>
Date: Tue, 07 Apr 2009 07:35:56 -0400

Quoted 22 lines · Hugo Mills

There seems to be some issue over changing the names of the device that a btrfs filesystem lives on:

# lvcreate scratch -n fstest -L 2G
Logical volume "fstest" created
# mkfs -t btrfs /dev/scratch/fstest

WARNING! - Btrfs v0.18-ge3b0f66 IS EXPERIMENTAL WARNING! - see http://btrfs.wiki.kernel.org before using

fs created label (null) on /dev/scratch/fs1 nodesize 4096 leafsize 4096 sectorsize 4096 size 2.00GB Btrfs v0.18-ge3b0f66

# mount /dev/scratch/fstest /mnt
# umount /mnt
# lvrename scratch fstest derek
Renamed "fstest" to "derek" in volume group "scratch"
# mount /dev/scratch/derek /mnt
mount: /dev/mapper/scratch-derek: can't read superblock
Quoted 7 lines
# lvrename scratch derek fstest
Renamed "derek" to "fstest" in volume group "scratch"
# mount /dev/scratch/fstest /mnt
[success]

The rename works properly on a completely virgin filesystem, but not on one that's been mounted and unmounted (as above).

Quoted 6 lines

Whoops, we need to reset the pathname when a probe finds a given dev uuid on a given device. I'll patch it up when I get back next week.

Thanks for this bug report.

-chris

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

#2 lore raw

PATCH 1/1 btrfs: Update existing btrfs_device for renaming device

This patch updates device name in btrfs device.
We can mount a device if its name are changed.

---
 fs/btrfs/volumes.c |    7 +++++++
 1 file changed, 7 insertions(+)

Index: b/fs/btrfs/volumes.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

fs/btrfs/volumes.c +7 -0
@@ -365,6 +365,7 @@ static noinline int device_list_add(cons
 	struct btrfs_device *device;
 	struct btrfs_fs_devices *fs_devices;
 	u64 found_transid =3D btrfs_super_generation(disk_super);
+	char *name;
 
 	fs_devices =3D find_fsid(disk_super->fsid);
 	if (!fs_devices) {
@@ -411,6 +412,12 @@ static noinline int device_list_add(cons
 
 		device->fs_devices =3D fs_devices;
 		fs_devices->num_devices++;
+	} else if (strcmp(device->name, path)) {
+		name =3D kstrdup(path, GFP_NOFS);
+		if (!device->name)
+			return -ENOMEM;
+		kfree(device->name);
+		device->name =3D name;
 	}
 
 	if (found_transid > fs_devices->latest_trans) {
Quoted 48 lines · Gustavo Alves

Hi Chris,
=20
I found the same problem on 2.6.32-0.33.rc5.git1 with btrfs-progs 0.19. This problem is already fixed?
=20
Thanks
=20
----
Gustavo Junior Alves
Specchio Solu=E7=F5es em TI
http://specchio.inf.br
Tel: +55 19 9223-0500
=20
=20

Quoted 34 lines

From: Chris Mason <chris.mason_=E4t_oracle.com>
Date: Tue, 07 Apr 2009 07:35:56 -0400

Quoted 29 lines · Hugo Mills

There seems to be some issue over changing the names of the device that a btrfs filesystem lives on:

# lvcreate scratch -n fstest -L 2G
Logical volume "fstest" created
# mkfs -t btrfs /dev/scratch/fstest

WARNING! - Btrfs v0.18-ge3b0f66 IS EXPERIMENTAL WARNING! - see http://btrfs.wiki.kernel.org before using

fs created label (null) on /dev/scratch/fs1 nodesize 4096 leafsize 4096 sectorsize 4096 size 2.00GB Btrfs v0.18-ge3b0f66

# mount /dev/scratch/fstest /mnt
# umount /mnt
# lvrename scratch fstest derek
Renamed "fstest" to "derek" in volume group "scratch"
# mount /dev/scratch/derek /mnt
mount: /dev/mapper/scratch-derek: can't read superblock
# lvrename scratch derek fstest
Renamed "derek" to "fstest" in volume group "scratch"
# mount /dev/scratch/fstest /mnt
[success]

The rename works properly on a completely virgin filesystem, but not on one that's been mounted and unmounted (as above).

Quoted 8 lines
Quoted 6 lines

Whoops, we need to reset the pathname when a probe finds a given dev uuid on a given device. I'll patch it up when I get back next week.

Thanks for this bug report.

-chris

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs=

" in

Quoted 2 lines

the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--=20
taruisi

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

#3 lore raw

Re: [PATCH]btrfs: Update existing btrfs_device for renaming device

Quoted 10 lines · TARUISI Hiroaki

This patch updates device name in btrfs device.
We can mount a device if its name are changed.
=20

---
 fs/btrfs/volumes.c |    7 +++++++
 1 file changed, 7 insertions(+)

=20
Index: b/fs/btrfs/volumes.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

Quoted 12 lines
fs/btrfs/volumes.c +1 -0
@@ -365,6 +365,7 @@ static noinline int device_list_add(cons
 	struct btrfs_device *device;
 	struct btrfs_fs_devices *fs_devices;
 	u64 found_transid =3D btrfs_super_generation(disk_super);
+	char *name;

=20

fs/btrfs/volumes.c +0 -0
 	fs_devices =3D find_fsid(disk_super->fsid);
 	if (!fs_devices) {
@@ -411,6 +412,12 @@ static noinline int device_list_add(cons

=20

fs/btrfs/volumes.c static noinline int device_list_add(cons · line 417

Quoted 5 lines
fs/btrfs/volumes.c +3 -0
 		device->fs_devices =3D fs_devices;
 		fs_devices->num_devices++;
+	} else if (strcmp(device->name, path)) {
+		name =3D kstrdup(path, GFP_NOFS);
+		if (!device->name)

It should be "if (!name)" here?

Quoted 4 lines
fs/btrfs/volumes.c +3 -0
+			return -ENOMEM;
+		kfree(device->name);
+		device->name =3D name;
 	}
Quoted 52 lines

=20
if (found_transid > fs_devices->latest_trans) {
=20

Quoted 48 lines · Gustavo Alves

Hi Chris,

I found the same problem on 2.6.32-0.33.rc5.git1 with btrfs-progs 0.19. This problem is already fixed?

Thanks

----
Gustavo Junior Alves
Specchio Solu=E7=F5es em TI
http://specchio.inf.br
Tel: +55 19 9223-0500

Quoted 34 lines

From: Chris Mason <chris.mason_=E4t_oracle.com>
Date: Tue, 07 Apr 2009 07:35:56 -0400

Quoted 22 lines · Hugo Mills

There seems to be some issue over changing the names of the device that a btrfs filesystem lives on:

# lvcreate scratch -n fstest -L 2G
Logical volume "fstest" created
# mkfs -t btrfs /dev/scratch/fstest

WARNING! - Btrfs v0.18-ge3b0f66 IS EXPERIMENTAL WARNING! - see http://btrfs.wiki.kernel.org before using

fs created label (null) on /dev/scratch/fs1 nodesize 4096 leafsize 4096 sectorsize 4096 size 2.00GB Btrfs v0.18-ge3b0f66

# mount /dev/scratch/fstest /mnt
# umount /mnt
# lvrename scratch fstest derek
Renamed "fstest" to "derek" in volume group "scratch"
# mount /dev/scratch/derek /mnt
mount: /dev/mapper/scratch-derek: can't read superblock
Quoted 7 lines
# lvrename scratch derek fstest
Renamed "derek" to "fstest" in volume group "scratch"
# mount /dev/scratch/fstest /mnt
[success]

The rename works properly on a completely virgin filesystem, but not on one that's been mounted and unmounted (as above).

Whoops, we need to reset the pathname when a probe finds a given de=

v

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

uuid on a given device. I'll patch it up when I get back next week.

Thanks for this bug report.

-chris

--
To unsubscribe from this list: send the line "unsubscribe linux-btrf=

s" in

Quoted 4 lines
Quoted 2 lines

the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

=20
=20

--=20
Regards
Yang Hongyang
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Re: [PATCH]btrfs: Update existing btrfs_device for renaming device

Yes, exactly. I'll fix this. Thanks.

Regards,
taruisi

Quoted 11 lines · Yang Hongyang
Quoted 10 lines · TARUISI Hiroaki

This patch updates device name in btrfs device.
We can mount a device if its name are changed.

---
 fs/btrfs/volumes.c |    7 +++++++
 1 file changed, 7 insertions(+)

Index: b/fs/btrfs/volumes.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

Quoted 12 lines
Quoted 12 lines
fs/btrfs/volumes.c +1 -0
@@ -365,6 +365,7 @@ static noinline int device_list_add(cons
 	struct btrfs_device *device;
 	struct btrfs_fs_devices *fs_devices;
 	u64 found_transid =3D btrfs_super_generation(disk_super);
+	char *name;
 
 	fs_devices =3D find_fsid(disk_super->fsid);
 	if (!fs_devices) {
@@ -411,6 +412,12 @@ static noinline int device_list_add(cons
 
Quoted 35 lines

fs/btrfs/volumes.c static noinline int device_list_add(cons · line 417

Quoted 5 lines
fs/btrfs/volumes.c +3 -0
 		device->fs_devices =3D fs_devices;
 		fs_devices->num_devices++;
+	} else if (strcmp(device->name, path)) {
+		name =3D kstrdup(path, GFP_NOFS);
+		if (!device->name)

=20
It should be "if (!name)" here?
=20

Quoted 27 lines
fs/btrfs/volumes.c +3 -0
+			return -ENOMEM;
+		kfree(device->name);
+		device->name =3D name;
 	}
 
 	if (found_transid > fs_devices->latest_trans) {
Quoted 19 lines · Gustavo Alves

Hi Chris,

I found the same problem on 2.6.32-0.33.rc5.git1 with btrfs-progs 0.19. This problem is already fixed?

Thanks

----
Gustavo Junior Alves
Specchio Solu=E7=F5es em TI
http://specchio.inf.br
Tel: +55 19 9223-0500

Quoted 5 lines

From: Chris Mason <chris.mason_=E4t_oracle.com>
Date: Tue, 07 Apr 2009 07:35:56 -0400

Quoted 1 line · Hugo Mills

There seems to be some issue over changing the names of the devic=

e

Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines

that a btrfs filesystem lives on:

# lvcreate scratch -n fstest -L 2G
Logical volume "fstest" created
# mkfs -t btrfs /dev/scratch/fstest

WARNING! - Btrfs v0.18-ge3b0f66 IS EXPERIMENTAL WARNING! - see http://btrfs.wiki.kernel.org before using

fs created label (null) on /dev/scratch/fs1 nodesize 4096 leafsize 4096 sectorsize 4096 size 2.00GB Btrfs v0.18-ge3b0f66

# mount /dev/scratch/fstest /mnt
# umount /mnt
# lvrename scratch fstest derek
Renamed "fstest" to "derek" in volume group "scratch"
# mount /dev/scratch/derek /mnt
mount: /dev/mapper/scratch-derek: can't read superblock
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
# lvrename scratch derek fstest
Renamed "derek" to "fstest" in volume group "scratch"
# mount /dev/scratch/fstest /mnt
[success]

The rename works properly on a completely virgin filesystem, but not on one that's been mounted and unmounted (as above).

Whoops, we need to reset the pathname when a probe finds a given d=

ev

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

uuid on a given device. I'll patch it up when I get back next week=

=2E

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

Thanks for this bug report.

-chris

--
To unsubscribe from this list: send the line "unsubscribe linux-btr=

fs" in

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

=20
=20

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

#5 lore raw

PATCH v2 1/1 btrfs: Update existing btrfs_device for renaming device

In reply to Gustavo Alves

This patch updates device name in btrfs device information. We can mount a device if its name are changed.

---
 fs/btrfs/volumes.c |    7 +++++++
 1 file changed, 7 insertions(+)

Index: b/fs/btrfs/volumes.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

fs/btrfs/volumes.c +7 -0
@@ -365,6 +365,7 @@ static noinline int device_list_add(cons
 	struct btrfs_device *device;
 	struct btrfs_fs_devices *fs_devices;
 	u64 found_transid =3D btrfs_super_generation(disk_super);
+	char *name;
 
 	fs_devices =3D find_fsid(disk_super->fsid);
 	if (!fs_devices) {
@@ -411,6 +412,12 @@ static noinline int device_list_add(cons
 
 		device->fs_devices =3D fs_devices;
 		fs_devices->num_devices++;
+	} else if (strcmp(device->name, path)) {
+		name =3D kstrdup(path, GFP_NOFS);
+		if (!name)
+			return -ENOMEM;
+		kfree(device->name);
+		device->name =3D name;
 	}
 
 	if (found_transid > fs_devices->latest_trans) {
Quoted 48 lines · Gustavo Alves

Hi Chris,
=20
I found the same problem on 2.6.32-0.33.rc5.git1 with btrfs-progs 0.19. This problem is already fixed?
=20
Thanks
=20
----
Gustavo Junior Alves
Specchio Solu=E7=F5es em TI
http://specchio.inf.br
Tel: +55 19 9223-0500
=20
=20

Quoted 34 lines

From: Chris Mason <chris.mason_=E4t_oracle.com>
Date: Tue, 07 Apr 2009 07:35:56 -0400

Quoted 29 lines · Hugo Mills

There seems to be some issue over changing the names of the device that a btrfs filesystem lives on:

# lvcreate scratch -n fstest -L 2G
Logical volume "fstest" created
# mkfs -t btrfs /dev/scratch/fstest

WARNING! - Btrfs v0.18-ge3b0f66 IS EXPERIMENTAL WARNING! - see http://btrfs.wiki.kernel.org before using

fs created label (null) on /dev/scratch/fs1 nodesize 4096 leafsize 4096 sectorsize 4096 size 2.00GB Btrfs v0.18-ge3b0f66

# mount /dev/scratch/fstest /mnt
# umount /mnt
# lvrename scratch fstest derek
Renamed "fstest" to "derek" in volume group "scratch"
# mount /dev/scratch/derek /mnt
mount: /dev/mapper/scratch-derek: can't read superblock
# lvrename scratch derek fstest
Renamed "derek" to "fstest" in volume group "scratch"
# mount /dev/scratch/fstest /mnt
[success]

The rename works properly on a completely virgin filesystem, but not on one that's been mounted and unmounted (as above).

Quoted 8 lines
Quoted 6 lines

Whoops, we need to reset the pathname when a probe finds a given dev uuid on a given device. I'll patch it up when I get back next week.

Thanks for this bug report.

-chris

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs=

" in

Quoted 2 lines

the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--=20
taruisi

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