Skip to content

Commit

Permalink
copy: be more careful when trying to reflink
Browse files Browse the repository at this point in the history
  • Loading branch information
poettering committed Sep 22, 2015
1 parent c97e586 commit c622fbd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/basic/copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ int copy_bytes(int fdf, int fdt, uint64_t max_bytes, bool try_reflink) {
assert(fdt >= 0);

/* Try btrfs reflinks first. */
if (try_reflink && max_bytes == (uint64_t) -1) {
if (try_reflink &&
max_bytes == (uint64_t) -1 &&
lseek(fdf, 0, SEEK_CUR) == 0 &&
lseek(fdt, 0, SEEK_CUR) == 0) {

r = btrfs_reflink(fdf, fdt);
if (r >= 0)
return r;
Expand Down

0 comments on commit c622fbd

Please sign in to comment.