]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
btrfs: Check read-only status of roots during send
authorDavid Sterba <dsterba@suse.cz>
Mon, 16 Dec 2013 16:34:17 +0000 (17:34 +0100)
committerChris Mason <clm@fb.com>
Tue, 28 Jan 2014 21:20:01 +0000 (13:20 -0800)
commit2c68653787f91c62f8891209dc1f617088c822e4
tree4f17ea8a804b6174de028c85aa3037c6ec6d28de
parenta8d89f5ba0e17622cde8f5ac48ef745a9fb1e13b
btrfs: Check read-only status of roots during send

All the subvolues that are involved in send must be read-only during the
whole operation. The ioctl SUBVOL_SETFLAGS could be used to change the
status to read-write and the result of send stream is undefined if the
data change unexpectedly.

Fix that by adding a refcount for all involved roots and verify that
there's no send in progress during SUBVOL_SETFLAGS ioctl call that does
read-only -> read-write transition.

We need refcounts because there are no restrictions on number of send
parallel operations currently run on a single subvolume, be it source,
parent or one of the multiple clone sources.

Kernel is silent when the RO checks fail and returns EPERM. The same set
of checks is done already in userspace before send starts.

Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/ctree.h
fs/btrfs/ioctl.c
fs/btrfs/send.c