Do not skip RMW at the end of the file - skipping it may lead to data corruption (fix #116)
This commit is contained in:
@@ -505,13 +505,6 @@ static void nfs_do_align_write(nfs_kv_write_state *st, uint64_t ino, uint64_t of
|
||||
{
|
||||
// Requires read-modify-write in the end
|
||||
assert(st->offset+st->size <= st->new_size);
|
||||
if (st->offset+st->size == st->new_size)
|
||||
{
|
||||
// rmw can be skipped at end - we can just zero pad the request
|
||||
end_pad = alignment - (end % alignment);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto s = (end % alignment);
|
||||
if (good_size > s)
|
||||
good_size -= s;
|
||||
@@ -533,7 +526,6 @@ static void nfs_do_align_write(nfs_kv_write_state *st, uint64_t ino, uint64_t of
|
||||
st->waiting++;
|
||||
nfs_do_rmw(&st->rmw[1]);
|
||||
}
|
||||
}
|
||||
if (good_size > 0 || end_pad > 0 || begin_shdr)
|
||||
{
|
||||
// Normal write
|
||||
|
||||
Reference in New Issue
Block a user