diff options
author | TARUISI Hiroaki <taruishi.hiroak@jp.fujitsu.com> | 2010-02-09 09:36:45 +0300 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2010-03-15 18:00:10 +0300 |
commit | 3a0524dc054791688177544fe510d2868ee20d9f (patch) | |
tree | 4038b649e33a7f41fd653a16af5766ca9cc6b7c5 /fs/btrfs/volumes.c | |
parent | 1e701a3292e25a6c4939cad9f24951dc6b6ad853 (diff) | |
download | linux-3a0524dc054791688177544fe510d2868ee20d9f.tar.xz |
btrfs: Update existing btrfs_device for renaming device
When we scan devices in a multi-device filesystem, we memorize the original
name. If the device gets a new name, later scans don't update the
in-kernel structures related to it, and we're not able to mount the
filesystem.
This patch updates device name during scaning.
Signed-off-by: TARUISI Hiroaki <taruishi.hiroak@jp.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index ace2e8d7bbcd..eb89e1317aca 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -365,6 +365,7 @@ static noinline int device_list_add(const char *path, 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(const char *path, 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) { |