From: Xiubo Li via B4 Relay <devnull+xiubo.li.clyso.com@kernel.org>
To: Ilya Dryomov <idryomov@gmail.com>,
Alex Markuze <amarkuze@redhat.com>,
Viacheslav Dubeyko <slava@dubeyko.com>
Cc: ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
Xiubo Li <xiubo.li@clyso.com>
Subject: [PATCH 0/2] ceph: don't let a mapped write overwrite other clients' writes
Date: Fri, 04 Dec 2026 01:22:10 +0100 [thread overview]
Message-ID: <20261204-ceph-mmap-no-overwrite-v1-0-323689b39a29@clyso.com> (raw)
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>
next reply other threads:[~2026-12-04 0:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 0:22 Xiubo Li via B4 Relay [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261204-ceph-mmap-no-overwrite-v1-0-323689b39a29@clyso.com \
--to=devnull+xiubo.li.clyso.com@kernel.org \
--cc=amarkuze@redhat.com \
--cc=ceph-devel@vger.kernel.org \
--cc=idryomov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=slava@dubeyko.com \
--cc=xiubo.li@clyso.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®