]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
selftests: ceph: wire up Ceph reset kselftests and documentation
authorAlex Markuze <amarkuze@redhat.com>
Thu, 7 May 2026 10:05:41 +0000 (10:05 +0000)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 20 May 2026 00:20:20 +0000 (02:20 +0200)
Wire the CephFS reset test suite into the kselftest build:

  - Add filesystems/ceph to the top-level selftests Makefile.
  - Add the per-suite Makefile with run_validation.sh as TEST_PROGS.
  - Add the settings file (kselftest timeout).
  - Add the MAINTAINERS entry for the test directory.
  - Add README with prerequisites, usage, and troubleshooting.

Signed-off-by: Alex Markuze <amarkuze@redhat.com>
Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Signed-off-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
MAINTAINERS
fs/ceph/mds_client.c
fs/ceph/mds_client.h
tools/testing/selftests/Makefile
tools/testing/selftests/filesystems/ceph/Makefile [new file with mode: 0644]
tools/testing/selftests/filesystems/ceph/README [new file with mode: 0644]
tools/testing/selftests/filesystems/ceph/settings [new file with mode: 0644]

index c2c6d79275c6ebe7ab427c61a8381958cc88859d..441b556b967176d82a675d2fa31ec4294b19e61a 100644 (file)
@@ -5909,6 +5909,7 @@ B:        https://tracker.ceph.com/
 T:     git https://github.com/ceph/ceph-client.git
 F:     Documentation/filesystems/ceph.rst
 F:     fs/ceph/
+F:     tools/testing/selftests/filesystems/ceph/
 
 CERTIFICATE HANDLING
 M:     David Howells <dhowells@redhat.com>
index a516e93a9db1c37e1842cb4047d7ec59020957a1..c423be33039559c2ec47ac995f50c2102cda940c 100644 (file)
@@ -2359,6 +2359,7 @@ struct flush_dump_entry {
 static void dump_cap_flushes(struct ceph_mds_client *mdsc, u64 want_tid)
 {
        struct ceph_client *cl = mdsc->fsc->client;
+       int i;
        struct flush_dump_entry entries[CEPH_CAP_FLUSH_MAX_DUMP_ENTRIES];
        struct ceph_cap_flush *cf;
        int n = 0, remaining = 0;
@@ -2388,7 +2389,7 @@ static void dump_cap_flushes(struct ceph_mds_client *mdsc, u64 want_tid)
 
        pr_info_client(cl, "still waiting for cap flushes through %llu:\n",
                       want_tid);
-       for (int i = 0; i < n; i++) {
+       for (i = 0; i < n; i++) {
                struct flush_dump_entry *e = &entries[i];
 
                if (e->ci_null)
index b1a0621cd37e277c9d99117fded6cc5caede6a82..731d6ad04956dd936027e660af80aaa8e05fb83b 100644 (file)
@@ -121,6 +121,7 @@ static inline bool ceph_reset_is_idle(struct ceph_client_reset_state *st)
 {
        return READ_ONCE(st->phase) == CEPH_CLIENT_RESET_IDLE;
 }
+
 struct ceph_mds_cap_match {
        s64 uid;  /* default to MDS_AUTH_UID_ANY */
        u32 num_gids;
index 6e59b8f63e4163ec3038678444d3e65e055eb436..ab254ae793a92f0768c558d4db705516202f08cf 100644 (file)
@@ -32,6 +32,7 @@ TARGETS += exec
 TARGETS += fchmodat2
 TARGETS += filesystems
 TARGETS += filesystems/binderfs
+TARGETS += filesystems/ceph
 TARGETS += filesystems/epoll
 TARGETS += filesystems/fat
 TARGETS += filesystems/overlayfs
diff --git a/tools/testing/selftests/filesystems/ceph/Makefile b/tools/testing/selftests/filesystems/ceph/Makefile
new file mode 100644 (file)
index 0000000..4ad3e8d
--- /dev/null
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0
+
+TEST_PROGS := run_validation.sh
+TEST_FILES := reset_stress.sh reset_corner_cases.sh \
+             validate_consistency.py README settings
+
+include ../../lib.mk
diff --git a/tools/testing/selftests/filesystems/ceph/README b/tools/testing/selftests/filesystems/ceph/README
new file mode 100644 (file)
index 0000000..eb0092b
--- /dev/null
@@ -0,0 +1,84 @@
+# CephFS Client Reset Test Suite
+
+Test suite for the CephFS kernel client manual session reset feature.
+This trimmed set contains the single-client stress test, the targeted
+corner-case test, and the one-shot validation harness used during
+feature bring-up.
+
+## Prerequisites
+
+- Linux kernel with the CephFS client reset feature (this branch)
+- A running Ceph cluster with at least one MDS
+- Root access (debugfs requires it)
+- Python 3 (for validators)
+- flock utility (for lock tests, usually in util-linux)
+
+## Test inventory
+
+| Test | Script(s) | What it covers |
+|------|-----------|----------------|
+| Single-client stress | `reset_stress.sh` | I/O + resets + data integrity on one mount |
+| Corner cases | `reset_corner_cases.sh` | EBUSY, dirty caps, flock reclaim, unmount-during-reset |
+| Validation harness | `run_validation.sh` | baseline + corner cases + moderate/aggressive stress + final status check |
+
+## Quick start
+
+Stress run:
+
+    sudo ./reset_stress.sh --mount-point /mnt/cephfs --profile moderate
+
+Corner cases:
+
+    sudo ./reset_corner_cases.sh --mount-point /mnt/cephfs
+
+End-to-end validation:
+
+    sudo ./run_validation.sh --mount-point /mnt/cephfs
+
+## Stress profiles
+
+    baseline   - no resets, 1 IO + 1 rename, 600s
+    moderate   - reset every 5-15s, 2 IO + 1 rename, 900s
+    aggressive - reset every 1-5s, 4 IO + 2 rename, 900s
+    soak       - reset every 5-15s, 2 IO + 1 rename, 3600s
+
+## Key options (all scripts)
+
+    --mount-point PATH   CephFS mount point (required)
+    --client-id ID       Debugfs client id (auto-detected if one)
+
+reset_stress.sh additionally accepts:
+
+    --profile NAME       baseline|moderate|aggressive|soak
+    --duration-sec N     Override profile runtime
+    --no-reset           Disable reset injection
+    --out-dir PATH       Artifact directory
+
+## Corner case tests
+
+    [1/4] ebusy_rejection       Second reset rejected while first in-flight
+    [2/4] dirty_caps_at_reset   Reset with unflushed dirty caps
+    [3/4] flock_after_reset     Stale lock EIO + fresh lock after holder exit
+    [4/4] unmount_during_reset  umount during active reset (destroy-path wakeup)
+
+Test 4 requires creating a second CephFS mount instance and SKIPs if
+the host cannot do so.  See `--help` output for details.
+
+## Troubleshooting
+
+**No writable Ceph reset interface found:**
+Kernel lacks the reset feature, debugfs not mounted, or not root.
+Check: `ls /sys/kernel/debug/ceph/*/reset/`
+
+**Multiple Ceph clients found:**
+Use `--client-id` to select one.
+List: `ls /sys/kernel/debug/ceph/`
+
+## Files
+
+| File | Role |
+|------|------|
+| `reset_stress.sh` | Single-client stress test runner |
+| `validate_consistency.py` | Single-client post-run validator |
+| `reset_corner_cases.sh` | Corner case harness (4 sequential tests) |
+| `run_validation.sh` | One-shot validation harness |
diff --git a/tools/testing/selftests/filesystems/ceph/settings b/tools/testing/selftests/filesystems/ceph/settings
new file mode 100644 (file)
index 0000000..79b65bd
--- /dev/null
@@ -0,0 +1 @@
+timeout=1200