mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-23 07:23:12 +02:00
btrfs: use btrfs_record_snapshot_destroy() during rmdir
We are setting the parent directory's last_unlink_trans directly which may result in a concurrent task starting to log the directory not see the update and therefore can log the directory after we removed a child directory which had a snapshot within instead of falling back to a transaction commit. Replaying such a log tree would result in a mount failure since we can't currently delete snapshots (and subvolumes) during log replay. This is the type of failure described in commit1ec9a1ae1e
("Btrfs: fix unreplayable log after snapshot delete + parent dir fsync"). Fix this by using btrfs_record_snapshot_destroy() which updates the last_unlink_trans field while holding the inode's log_mutex lock. Fixes:44f714dae5
("Btrfs: improve performance on fsync against new inode after rename/unlink") Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
c466e33e72
commit
157501b046
|
@ -4750,7 +4750,7 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry)
|
||||||
* deletes for directory foo.
|
* deletes for directory foo.
|
||||||
*/
|
*/
|
||||||
if (BTRFS_I(inode)->last_unlink_trans >= trans->transid)
|
if (BTRFS_I(inode)->last_unlink_trans >= trans->transid)
|
||||||
BTRFS_I(dir)->last_unlink_trans = BTRFS_I(inode)->last_unlink_trans;
|
btrfs_record_snapshot_destroy(trans, BTRFS_I(dir));
|
||||||
|
|
||||||
if (unlikely(btrfs_ino(BTRFS_I(inode)) == BTRFS_EMPTY_SUBVOL_DIR_OBJECTID)) {
|
if (unlikely(btrfs_ino(BTRFS_I(inode)) == BTRFS_EMPTY_SUBVOL_DIR_OBJECTID)) {
|
||||||
ret = btrfs_unlink_subvol(trans, BTRFS_I(dir), dentry);
|
ret = btrfs_unlink_subvol(trans, BTRFS_I(dir), dentry);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user