summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2013-12-06 19:00:49 +0100
committerChris Mason <clm@fb.com>2014-01-31 08:22:13 -0800
commit2b3b68a2f09670c301703dacbb101ab3ebdb98bb (patch)
treef7744395f55299577d9e83d9b4bea5e215226b12
parent8d68cb2bad0e8e7951811e0641188c447165141f (diff)
btrfs-progs: send: check if parent or clone sources are read-only
Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
-rw-r--r--cmds-send.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/cmds-send.c b/cmds-send.c
index 302f5a89..85461d5b 100644
--- a/cmds-send.c
+++ b/cmds-send.c
@@ -504,6 +504,18 @@ int cmd_send(int argc, char **argv)
"root_id for %s\n", subvol);
goto out;
}
+
+ ret = is_subvol_ro(&send, subvol);
+ if (ret < 0)
+ goto out;
+ if (!ret) {
+ ret = -EINVAL;
+ fprintf(stderr,
+ "ERROR: cloned subvol %s is not read-only.\n",
+ subvol);
+ goto out;
+ }
+
add_clone_source(&send, root_id);
subvol_uuid_search_finit(&send.sus);
free(subvol);
@@ -532,6 +544,18 @@ int cmd_send(int argc, char **argv)
"%s\n", optarg, strerror(-ret));
goto out;
}
+
+ ret = is_subvol_ro(&send, snapshot_parent);
+ if (ret < 0)
+ goto out;
+ if (!ret) {
+ ret = -EINVAL;
+ fprintf(stderr,
+ "ERROR: parent %s is not read-only.\n",
+ snapshot_parent);
+ goto out;
+ }
+
full_send = 0;
break;
case 'i':