mirror of
https://github.com/kdave/btrfs-progs
synced 2025-01-14 01:31:02 +00:00
btrfs-progs: use openat for process_clone in receive
This will fix breakage, when doing chrooted receive with cloned paths outside main subvolume. Steps to reproduce: $ create subvolume $ create file $ snapshot to snap1 $ delete file $ snapshot to snap2 $ reflink file from snap1 $ snapsthot to snap3 $ send full snap1 | receive --chroot $ send incremental snap2 | receive --chroot $ send incremental snap3 | receive --chroot The last step would fail with: Chroot to /mnt/recvdir At snapshot snap3 ERROR: failed to open /recvdir/snap1/file. No such file or directory Signed-off-by: Emil Karlson <jekarlson@gmail.com> [added reproducer] Signed-off-by: David Sterba <dsterba@suse.cz>
This commit is contained in:
parent
b51cc1d325
commit
5d4f3ea9b4
@ -609,9 +609,9 @@ static int process_clone(const char *path, u64 offset, u64 len,
|
||||
subvol_path = strdup(si->path);
|
||||
}
|
||||
|
||||
full_clone_path = path_cat3(r->root_path, subvol_path, clone_path);
|
||||
full_clone_path = path_cat(subvol_path, clone_path);
|
||||
|
||||
clone_fd = open(full_clone_path, O_RDONLY | O_NOATIME);
|
||||
clone_fd = openat(r->mnt_fd, full_clone_path, O_RDONLY | O_NOATIME);
|
||||
if (clone_fd < 0) {
|
||||
ret = -errno;
|
||||
fprintf(stderr, "ERROR: failed to open %s. %s\n",
|
||||
|
Loading…
Reference in New Issue
Block a user