Skip to content

Commit 135edb1

Browse files
authored
fix: prevent data loss on writes larger than the tape block size. (#607)
1 parent aa05125 commit 135edb1

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/iosched/unified.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1790,7 +1790,11 @@ ssize_t _unified_insert_new_request(const char *buf, off_t offset, size_t count,
17901790
if (new_req->offset + new_req->count > dpr->file_size)
17911791
dpr->file_size = new_req->offset + new_req->count;
17921792

1793-
return (ssize_t)count;
1793+
/* Only copy_count bytes were stored (one cache block at most); the
1794+
* caller's append loop must advance by that, not the full count, or
1795+
* everything past the first block of a larger-than-blocksize write is
1796+
* silently dropped. */
1797+
return (ssize_t)copy_count;
17941798
}
17951799

17961800
/**

0 commit comments

Comments
 (0)