Commit f4f359e
committed
client: restrict bufferlist to total write size
In linux, systems calls like write() anyways don't allow writes > 2GiB,
the total write size passed to the Client::_write is clamped to INT_MAX
but bufferlist is not handled. This edge case is patched here.
bug that arises due to buffer list beyond INT_MAX stalls async i/o due to:
unknown file: Failure
C++ exception with description "End of buffer [buffer:2]" thrown in the test body.
2024-05-28T16:17:06.854+0530 7f9a5d24c9c0 2 client.4311 unmount
2024-05-28T16:17:06.854+0530 7f9a5d24c9c0 2 client.4311 unmounting
which results in disconnected inode and cap leaks:
2024-05-28T16:17:11.855+0530 7f9a5d24c9c0 1 client.4311 dump_inode: DISCONNECTED inode 0x10000000001 #0x10000000001 ref 3 0x10000000001.head(faked_ino=0 nref=3 ll_ref=0 cap_refs={4=0,1024=1,4096=1,8192=2} open={3=0} mode=100666 size=0/4294967296 nlink=1 btime=2024-05-28T16:17:03.387546+0530 mtime=2024-05-28T16:17:03.387546+0530 ctime=2024-05-28T16:17:03.387546+0530 change_attr=0 caps=pAsxLsXsxFsxcrwb(0=pAsxLsXsxFsxcrwb) objectset[0x10000000001 ts 0/0 objects 1 dirty_or_tx 0] 0x7f9a2c009530)
2024-05-28T16:17:11.855+0530 7f9a5d24c9c0 2 client.4311 cache still has 0+1 items, waiting (for caps to release?)
This commit changes the way Client::_write accepts data. So, now instead of accepting ptr,
iovec array and iovcnt, the helper now accepts a bufferlist which should be contructed by
the caller itself. The reason behind this change is simple - to declutter the API.
For more context checkout this conversation ceph#58564 (comment)
Fixes: https://tracker.ceph.com/issues/66245
Signed-off-by: Dhairya Parmar <[email protected]>1 parent 28b15bd commit f4f359e
2 files changed
+31
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11305 | 11305 | | |
11306 | 11306 | | |
11307 | 11307 | | |
11308 | | - | |
| 11308 | + | |
| 11309 | + | |
| 11310 | + | |
11309 | 11311 | | |
11310 | 11312 | | |
11311 | 11313 | | |
| |||
11330 | 11332 | | |
11331 | 11333 | | |
11332 | 11334 | | |
11333 | | - | |
| 11335 | + | |
11334 | 11336 | | |
11335 | 11337 | | |
11336 | 11338 | | |
| |||
11340 | 11342 | | |
11341 | 11343 | | |
11342 | 11344 | | |
| 11345 | + | |
11343 | 11346 | | |
11344 | | - | |
| 11347 | + | |
| 11348 | + | |
| 11349 | + | |
| 11350 | + | |
| 11351 | + | |
| 11352 | + | |
| 11353 | + | |
| 11354 | + | |
| 11355 | + | |
| 11356 | + | |
| 11357 | + | |
| 11358 | + | |
| 11359 | + | |
| 11360 | + | |
| 11361 | + | |
| 11362 | + | |
| 11363 | + | |
11345 | 11364 | | |
11346 | 11365 | | |
11347 | 11366 | | |
11348 | | - | |
| 11367 | + | |
11349 | 11368 | | |
11350 | 11369 | | |
11351 | 11370 | | |
| |||
11529 | 11548 | | |
11530 | 11549 | | |
11531 | 11550 | | |
11532 | | - | |
11533 | | - | |
11534 | | - | |
| 11551 | + | |
| 11552 | + | |
11535 | 11553 | | |
11536 | 11554 | | |
11537 | 11555 | | |
| |||
11601 | 11619 | | |
11602 | 11620 | | |
11603 | 11621 | | |
11604 | | - | |
11605 | | - | |
11606 | | - | |
11607 | | - | |
11608 | | - | |
11609 | | - | |
11610 | | - | |
11611 | | - | |
11612 | | - | |
11613 | | - | |
11614 | | - | |
11615 | | - | |
11616 | | - | |
11617 | 11622 | | |
11618 | 11623 | | |
11619 | 11624 | | |
| |||
16066 | 16071 | | |
16067 | 16072 | | |
16068 | 16073 | | |
16069 | | - | |
| 16074 | + | |
| 16075 | + | |
| 16076 | + | |
16070 | 16077 | | |
16071 | 16078 | | |
16072 | 16079 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1715 | 1715 | | |
1716 | 1716 | | |
1717 | 1717 | | |
1718 | | - | |
1719 | | - | |
1720 | | - | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
1721 | 1721 | | |
1722 | 1722 | | |
1723 | 1723 | | |
| |||
0 commit comments