diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 1421d711629fa572edd782e5688e72ee24198c63..2fdd2d3322aaecfc640c476cac478ed0e44723c0 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -699,7 +699,8 @@ static noinline int device_list_add(const char *path, * if there is new btrfs on an already registered device, * then remove the stale device entry. */ - btrfs_free_stale_device(device); + if (ret > 0) + btrfs_free_stale_device(device); *fs_devices_ret = fs_devices;