mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-01 12:04:08 +00:00
btrfs: simplify the send_in_progress check in btrfs_delete_subvolume
Only when send_in_progress, we have to do something different such as btrfs_warn() and return -EPERM. Therefore, we could check send_in_progress first and process error handling, after the root_item_lock has been got. Just for better readability. No functional change. Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
35a7f35ad1
commit
a7176f74fa
1 changed files with 5 additions and 6 deletions
|
@ -4270,18 +4270,17 @@ int btrfs_delete_subvolume(struct inode *dir, struct dentry *dentry)
|
||||||
* again is not run concurrently.
|
* again is not run concurrently.
|
||||||
*/
|
*/
|
||||||
spin_lock(&dest->root_item_lock);
|
spin_lock(&dest->root_item_lock);
|
||||||
root_flags = btrfs_root_flags(&dest->root_item);
|
if (dest->send_in_progress) {
|
||||||
if (dest->send_in_progress == 0) {
|
|
||||||
btrfs_set_root_flags(&dest->root_item,
|
|
||||||
root_flags | BTRFS_ROOT_SUBVOL_DEAD);
|
|
||||||
spin_unlock(&dest->root_item_lock);
|
|
||||||
} else {
|
|
||||||
spin_unlock(&dest->root_item_lock);
|
spin_unlock(&dest->root_item_lock);
|
||||||
btrfs_warn(fs_info,
|
btrfs_warn(fs_info,
|
||||||
"attempt to delete subvolume %llu during send",
|
"attempt to delete subvolume %llu during send",
|
||||||
dest->root_key.objectid);
|
dest->root_key.objectid);
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
|
root_flags = btrfs_root_flags(&dest->root_item);
|
||||||
|
btrfs_set_root_flags(&dest->root_item,
|
||||||
|
root_flags | BTRFS_ROOT_SUBVOL_DEAD);
|
||||||
|
spin_unlock(&dest->root_item_lock);
|
||||||
|
|
||||||
down_write(&fs_info->subvol_sem);
|
down_write(&fs_info->subvol_sem);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue