Hi Eric, Today's linux-next merge of the userns tree got a conflict in fs/btrfs/ioctl.c between commit e4e7602f3304 ("btrfs: protect snapshots from deleting during send") from the btrfs tree and commit 23135a9bd700 ("vfs: Make d_invalidate return void") from the userns tree. I fixed it up (see below) and can carry the fix as necessary (no action is required). Thanks, Chris for the resolution. -- Cheers, Stephen Rothwell sfr@xxxxxxxxxxxxxxxx diff --cc fs/btrfs/ioctl.c index 99431aa5371f,349848bd54e2..000000000000 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@@ -2334,30 -2229,7 +2334,28 @@@ static noinline int btrfs_ioctl_snap_de } mutex_lock(&inode->i_mutex); + + /* + * Don't allow to delete a subvolume with send in progress. This is + * inside the i_mutex so the error handling that has to drop the bit + * again is not run concurrently. + */ + spin_lock(&dest->root_item_lock); + root_flags = btrfs_root_flags(&dest->root_item); + 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); + btrfs_warn(root->fs_info, + "Attempt to delete subvolume %llu during send", + dest->root_key.objectid); + err = -EPERM; + goto out_dput; + } + - err = d_invalidate(dentry); - if (err) - goto out_unlock; + d_invalidate(dentry); down_write(&root->fs_info->subvol_sem); @@@ -2442,14 -2314,6 +2440,14 @@@ out_release btrfs_subvolume_release_metadata(root, &block_rsv, qgroup_reserved); out_up_write: up_write(&root->fs_info->subvol_sem); - out_unlock: ++ + if (err) { + spin_lock(&dest->root_item_lock); + 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); + } mutex_unlock(&inode->i_mutex); if (!err) { shrink_dcache_sb(root->fs_info->sb);
Attachment:
signature.asc
Description: PGP signature