Skip to content

Commit 0f23ae7

Browse files
committed
Revert "Btrfs: device_list_add() should not update list when mounted"
This reverts commit b96de00. This commit is triggering failures to mount by subvolume id in some configurations. The main problem is how many different ways this scanning function is used, both for scanning while mounted and unmounted. A proper cleanup is too big for late rcs. For now, just revert the commit and we'll put a better fix into a later merge window. Signed-off-by: Chris Mason <[email protected]>
1 parent 125c4cf commit 0f23ae7

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

fs/btrfs/volumes.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -529,21 +529,20 @@ static noinline int device_list_add(const char *path,
529529
*/
530530

531531
/*
532-
* As of now don't allow update to btrfs_fs_device through
533-
* the btrfs dev scan cli, after FS has been mounted.
532+
* For now, we do allow update to btrfs_fs_device through the
533+
* btrfs dev scan cli after FS has been mounted. We're still
534+
* tracking a problem where systems fail mount by subvolume id
535+
* when we reject replacement on a mounted FS.
534536
*/
535-
if (fs_devices->opened) {
536-
return -EBUSY;
537-
} else {
537+
if (!fs_devices->opened && found_transid < device->generation) {
538538
/*
539539
* That is if the FS is _not_ mounted and if you
540540
* are here, that means there is more than one
541541
* disk with same uuid and devid.We keep the one
542542
* with larger generation number or the last-in if
543543
* generation are equal.
544544
*/
545-
if (found_transid < device->generation)
546-
return -EEXIST;
545+
return -EEXIST;
547546
}
548547

549548
name = rcu_string_strdup(path, GFP_NOFS);

0 commit comments

Comments
 (0)