diff mbox

btrfs: Update existing btrfs_device for renaming device

Message ID 4B70DB0D.2060007@jp.fujitsu.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

TARUISI Hiroaki Feb. 9, 2010, 3:48 a.m. UTC
None
diff mbox

Patch

Index: b/fs/btrfs/volumes.c
===================================================================
--- a/fs/btrfs/volumes.c	2010-02-09 12:11:33.000000000 +0900
+++ b/fs/btrfs/volumes.c	2010-02-09 12:43:29.000000000 +0900
@@ -365,6 +365,7 @@  static noinline int device_list_add(cons
 	struct btrfs_device *device;
 	struct btrfs_fs_devices *fs_devices;
 	u64 found_transid = btrfs_super_generation(disk_super);
+	char *name;

 	fs_devices = find_fsid(disk_super->fsid);
 	if (!fs_devices) {
@@ -411,6 +412,12 @@  static noinline int device_list_add(cons

 		device->fs_devices = fs_devices;
 		fs_devices->num_devices++;
+	} else if (strcmp(device->name, path)) {
+		name = kstrdup(path, GFP_NOFS);
+		if (!device->name)
+			return -ENOMEM;
+		kfree(device->name);
+		device->name = name;
 	}

 	if (found_transid > fs_devices->latest_trans) {