summary refs log tree commit diff
path: root/fs/minix
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2014-07-31 14:41:07 +0100
committerChris Mason <clm@fb.com>2014-08-21 07:55:21 -0700
commit9c3b306e1c9e6be4be09e99a8fe2227d1005effc (patch)
tree3959abb99f9d14ae1ab26c0c2735e56504e5939b /fs/minix
parent87fa3bb0786f37dff0b92f2c38421dd56d8902a9 (diff)
downloadlinux-9c3b306e1c9e6be4be09e99a8fe2227d1005effc.tar.gz
Btrfs: race free update of commit root for ro snapshots
This is a better solution for the problem addressed in the following
commit:

    Btrfs: update commit root on snapshot creation after orphan cleanup
    (3821f348889e506efbd268cc8149e0ebfa47c4e5)

The previous solution wasn't the best because of 2 reasons:

    1) It added another full transaction commit, which is more expensive
       than just swapping the commit root with the root;

    2) If a reboot happened after the first transaction commit (the one
       that creates the snapshot) and before the second transaction commit,
       then we would end up with the same problem if a send using that
       snapshot was requested before the first transaction commit after
       the reboot.

This change addresses those 2 issues. The second issue is addressed by
switching the commit root in the dentry lookup VFS callback, which is
also called by the snapshot/subvol creation ioctl and performs orphan
cleanup if needed. Like the vfs, the ioctl locks the parent inode too,
preventing race issues between a dentry lookup and snapshot creation.

Cc: Alex Lyakas <alex.btrfs@zadarastorage.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/minix')
0 files changed, 0 insertions, 0 deletions