Commit ba69994a authored by Ilya Dryomov's avatar Ilya Dryomov Committed by Chris Mason

Btrfs: fix __btrfs_start_workers retval

__btrfs_start_workers returns 0 in case it raced with
btrfs_stop_workers and lost the race.  This is wrong because worker in
this case is not allowed to start and is in fact destroyed.  Return
-EINVAL instead.
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
parent 908960c6
...@@ -495,6 +495,7 @@ static int __btrfs_start_workers(struct btrfs_workers *workers) ...@@ -495,6 +495,7 @@ static int __btrfs_start_workers(struct btrfs_workers *workers)
spin_lock_irq(&workers->lock); spin_lock_irq(&workers->lock);
if (workers->stopping) { if (workers->stopping) {
spin_unlock_irq(&workers->lock); spin_unlock_irq(&workers->lock);
ret = -EINVAL;
goto fail_kthread; goto fail_kthread;
} }
list_add_tail(&worker->worker_list, &workers->idle_list); list_add_tail(&worker->worker_list, &workers->idle_list);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment