mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] ceph: don't let a mapped write overwrite other clients' writes
@ 2026-12-04  0:22 Xiubo Li via B4 Relay
  2026-12-04  0:22 ` [PATCH 1/2] libceph: add the CMPEXT OSD op Xiubo Li via B4 Relay
  2026-12-04  0:22 ` [PATCH 2/2] ceph: don't let a mapped write overwrite other clients' writes Xiubo Li via B4 Relay
  0 siblings, 2 replies; 5+ messages in thread
From: Xiubo Li via B4 Relay @ 2026-12-04  0:22 UTC (permalink / raw)
  To: Ilya Dryomov, Alex Markuze, Viacheslav Dubeyko
  Cc: ceph-devel, linux-kernel, Xiubo Li

Alex pointed out in his review of "ceph: only check the caps of a clean
file early after its last close" that a MAP_SHARED store on a client
holding Fw but neither Fb nor Fc (the file in MIX) dirties the whole
folio, so its writeback can overwrite a write another client has
completed.  This happens without that patch as well; this series fixes
it.

Patch 1 adds the CMPEXT OSD op to libceph.  Patch 2 keeps a copy of a
folio dirtied that way, and writes back only the bytes this client
changed: as WRITE ops of just the changed ranges when they are few, or
else as whole runs of folios behind a CMPEXT of the copy, which falls
back to the changed ranges when another client wrote there meanwhile.

Testing, on a vstart cluster with three kernel mounts of one fs (A, B
and C), KASAN and lockdep enabled, 3 rounds, no splats:
- B stores through a shared mapping while C pwrite()s disjoint bytes of
  the same pages: before, C's bytes were lost; now none are.
- B and C store through shared mappings and A pwrite()s, each into its
  own 64-byte stripes, for 30s: every byte is its owner's last write.
- After B's own writeback, B's mapping shows what C wrote afterwards,
  and B's next store does not undo it.
- fsx with a second client holding the file open for writing.

Performance, release config, B storing 8 bytes into K random pages of
a 1 MiB file and calling msync(), 30s per run, median of 3-5
alternating runs, ops/s:

  case                         before    after
  MIX, K=1                       9403     9422   +0.2%
  MIX, K=16                      2072     2089   +0.8%
  MIX + C pwrite()ing, K=1       6677     6765   +1.3%
  MIX + C pwrite()ing, K=16      1513     1502   -0.7%
  B alone (Fb), K=1             11577    12254   (noise, +-10%)
  B alone (Fb), K=16             5289     5275   -0.3%

p50-p95 msync() latency in MIX is up to 40us higher, p99-p99.99 lower.

Link to the patch Alex reviewed: https://patch.msgid.link/20261201-ceph-cap-idle-release-clean-only-v1-1-f4bb68a744db@clyso.com

Signed-off-by: Xiubo Li <xiubo.li@clyso.com>
---
Xiubo Li (2):
      libceph: add the CMPEXT OSD op
      ceph: don't let a mapped write overwrite other clients' writes

 fs/ceph/addr.c             | 757 ++++++++++++++++++++++++++++++++++++++++++---
 fs/ceph/inode.c            |   1 +
 fs/ceph/super.h            |   1 +
 include/linux/ceph/rados.h |   1 +
 net/ceph/osd_client.c      |  10 +-
 5 files changed, 722 insertions(+), 48 deletions(-)
---
base-commit: 3f90412e989cb381d4bf96260468f5c7b2d08655
change-id: 20261204-ceph-mmap-no-overwrite-b4bbfd1e2dcc

Best regards,
--  
Xiubo Li <xiubo.li@clyso.com>



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-12-05 10:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-04  0:22 [PATCH 0/2] ceph: don't let a mapped write overwrite other clients' writes Xiubo Li via B4 Relay
2026-12-04  0:22 ` [PATCH 1/2] libceph: add the CMPEXT OSD op Xiubo Li via B4 Relay
2026-12-04  0:22 ` [PATCH 2/2] ceph: don't let a mapped write overwrite other clients' writes Xiubo Li via B4 Relay
2026-12-05  9:55   ` kernel test robot
2026-12-05 10:55     ` Xiubo Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®