Skip to content

Commit

Permalink
fix #13: reproducible filesystem corruption with too-low RAM buffer s…
Browse files Browse the repository at this point in the history
…ize:

the loop copying continuous segments larger than RAM buffer was bugged,
it incremented only one iteration variable instead of all three.
  • Loading branch information
cosmos72 committed Mar 31, 2019
1 parent 00e1f86 commit 1a93573
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fsremap/src/io/io_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1022,8 +1022,6 @@ int fr_io_posix::flush_copy_bytes(fr_dir dir, fr_vector<ft_uoff> & request_vec)
if ((err = flush_copy_bytes(FC_POSIX_RAM2DEV, (ft_uoff) extent.user_data(), extent.logical(), extent.length())) != 0)
break;
}
if (err != 0)
break;
}

if (err != 0 || (err = flush_bytes()) != 0)
Expand All @@ -1046,7 +1044,9 @@ int fr_io_posix::flush_copy_bytes(fr_dir dir, fr_vector<ft_uoff> & request_vec)
|| (err = flush_bytes()) != 0)
break;

length -= (ft_uoff) buf_length;
length -= (ft_uoff) buf_length;
from_offset += (ft_uoff) buf_length;
to_offset += (ft_uoff) buf_length;
}
if (err != 0)
break;
Expand Down

0 comments on commit 1a93573

Please sign in to comment.