Commit c675610
committed
bfd: fix partial write handling in bwritev()
When bfd is unbuffered, bwritev() used writev() directly, which can return
partial writes and leave checkpoint images incomplete.
This patch adds bfd_writev_all() helper that retries writev() until all
iovecs are written or an error occurs. This matches the pattern used by
write_all() for single writes.
Changes:
- Add bfd_writev_all() helper to retry writev() until completion
- Return 0 early when cnt == 0 to avoid zero-size edge cases
- Treat a zero-byte writev() result as EIO to avoid infinite loops
- Cast away const on the iov parameter for bfd_writev_all()
Signed-off-by: Ahmed Elaidy <elaidya225@gmail.com>1 parent 33dca79 commit c675610
1 file changed
+47
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
278 | 313 | | |
279 | 314 | | |
280 | 315 | | |
281 | 316 | | |
282 | 317 | | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
288 | 330 | | |
289 | 331 | | |
290 | 332 | | |
| |||
0 commit comments