[v2] btrfs: Update existing btrfs_device for renaming device
diff mbox

Message ID 4B71027D.8080600@jp.fujitsu.com
State Accepted
Headers show

Commit Message

TARUISI Hiroaki Feb. 9, 2010, 6:36 a.m. UTC
None

Patch
diff mbox

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 13:54:39.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 (!name)
+			return -ENOMEM;
+		kfree(device->name);
+		device->name = name;
 	}

 	if (found_transid > fs_devices->latest_trans) {