]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: Ensure btrfs_init_dev_replace_tgtdev sees up to date values
authorNikolay Borisov <nborisov@suse.com>
Tue, 14 May 2019 10:54:41 +0000 (13:54 +0300)
committerDavid Sterba <dsterba@suse.com>
Mon, 1 Jul 2019 11:34:54 +0000 (13:34 +0200)
commita5943fc399fde7b676db55e2a5019483c6cf29cb
tree95ada1ff7ea829e189ae386955b9acdc392db0a9
parent3073fcb6492ff00c18926449d9cf10a51461e8e4
btrfs: Ensure btrfs_init_dev_replace_tgtdev sees up to date values

btrfs_init_dev_replace_tgtdev reads certain values from the source
device (such as commit_total_bytes) which are updated during transaction
commit. Currently this function is called before committing any pending
transaction, leading to possibly reading outdated values.

Fix this by moving the function below the transaction commit, at this
point the EXCL_OP bit it set hence once transaction is complete the
total size of the device cannot be changed (it's usually changed by
resize/remove ops which are blocked).

Fixes: 1e08b951412e ("Btrfs: kernel operation should come after user input has been verified")
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/dev-replace.c