Skip to content

Commit 1a93573

Browse files
committed
fix #13: reproducible filesystem corruption with too-low RAM buffer size:
the loop copying continuous segments larger than RAM buffer was bugged, it incremented only one iteration variable instead of all three.
1 parent 00e1f86 commit 1a93573

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fsremap/src/io/io_posix.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,8 +1022,6 @@ int fr_io_posix::flush_copy_bytes(fr_dir dir, fr_vector<ft_uoff> & request_vec)
10221022
if ((err = flush_copy_bytes(FC_POSIX_RAM2DEV, (ft_uoff) extent.user_data(), extent.logical(), extent.length())) != 0)
10231023
break;
10241024
}
1025-
if (err != 0)
1026-
break;
10271025
}
10281026

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

1049-
length -= (ft_uoff) buf_length;
1047+
length -= (ft_uoff) buf_length;
1048+
from_offset += (ft_uoff) buf_length;
1049+
to_offset += (ft_uoff) buf_length;
10501050
}
10511051
if (err != 0)
10521052
break;

0 commit comments

Comments
 (0)