Repository navigation
Conversation
|
Upstream branch: c03c1a1 |
90ea7e4 to
435b194
Compare
|
Upstream branch: 7be4bc5 |
75699bf to
b8955e3
Compare
435b194 to
fd67522
Compare
|
Upstream branch: 17bb0e2 |
b8955e3 to
168042c
Compare
fd67522 to
3b53a63
Compare
|
Upstream branch: 21a7f44 |
168042c to
3138fa3
Compare
3b53a63 to
5d84576
Compare
|
Upstream branch: 6b4b543 |
3138fa3 to
9fc62b7
Compare
5d84576 to
6582ed2
Compare
|
Upstream branch: fb2c3f4 |
9fc62b7 to
7917201
Compare
6582ed2 to
b3a1abc
Compare
|
Upstream branch: d135ab4 |
7917201 to
417e6e3
Compare
b3a1abc to
712496f
Compare
|
Upstream branch: c339f40 |
417e6e3 to
0d1ac43
Compare
712496f to
a186880
Compare
|
Upstream branch: d89e1d1 |
0d1ac43 to
38e8c32
Compare
a186880 to
46206a3
Compare
|
Upstream branch: 6628e7d |
38e8c32 to
4cad4b2
Compare
46206a3 to
220bd96
Compare
|
Upstream branch: 05441d6 |
4cad4b2 to
b68982b
Compare
220bd96 to
6c4625e
Compare
|
Upstream branch: f66469d |
b68982b to
2c377e3
Compare
6c4625e to
c7f678d
Compare
|
Upstream branch: d487237 |
2c377e3 to
a56e7d3
Compare
c7f678d to
6aa6cd1
Compare
nbd_start_device() drops config_lock while updating the hardware queue count. Two NBD_DO_IT callers can pass the initial nbd->pid check before either caller publishes its PID. After the first caller starts the device, the second caller overwrites nbd->pid and fails to create the existing sysfs pid attribute with -EEXIST. The running device then reports the losing caller's PID. Recheck nbd->pid after reacquiring config_lock and return -EBUSY if another caller has already started the device. Do this before retrying the queue update or changing any startup state. Fixes: 8b428f4 ("nbd: fix lockdep deadlock warning") Cc: stable@vger.kernel.org # v6.17+ Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
Add an NBD selftest that races two NBD_DO_IT callers and checks that the loser returns EBUSY while the sysfs pid attribute retains the successful caller's PID. Prime the device with a different connection count before each attempt so that the hardware queue update cannot take its no-op path. Use socket pairs and an exclusively opened unused device, with bounded waits and cleanup of the test's own configuration. Skip the test when CAP_SYS_ADMIN, at least two CPUs, or an unused NBD device is unavailable. Register the new nbd target with kselftest. The test uses scheduling stress rather than kernel instrumentation, so a passing run only means that no regression was observed during that run. The number of attempts, delays and random seed can be set on the command line. Load nbd with nbds_max=4 max_part=0 before running the test. Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
nbd_start_device() checks NBD_FLAG_CAN_MULTI_CONN before dropping config_lock to update the hardware queue count. A concurrent NBD_SET_SOCK can add a connection during that window, and NBD_SET_FLAGS can clear the flag without changing the connection count. The queue-count retry only notices changes to num_connections and does not repeat the flag check. Startup can therefore create multiple receive workers even though the server no longer advertises multi-connection support. Recheck the current connection count and flags after reacquiring config_lock, before retrying the queue update or starting the device. Return -EINVAL if multiple connections are no longer supported. Fixes: 8b428f4 ("nbd: fix lockdep deadlock warning") Cc: stable@vger.kernel.org # v6.17+ Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
Extend the NBD startup selftests to race NBD_DO_IT against adding a second socket without NBD_FLAG_CAN_MULTI_CONN, and against clearing the flag on a device that already has two sockets. Prime the queue count before each attempt to exercise the unlocked hardware queue update. Check for EINVAL or a valid single-connection start. Detect an invalid multi-connection start by checking whether a receive worker consumes a byte from the second socket. Keep the reply incomplete so that the check does not inject a malformed reply into request completion. Exclude flag changes observed after PID publication, since changing flags on an already running device is outside the startup race being tested. As with the concurrent-start test, this is scheduling stress and a passing run does not prove that every race window was exercised. Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
|
Upstream branch: b3dfbde |
a56e7d3 to
fb12d75
Compare
Pull request for series with
subject: nbd: revalidate startup state after queue updates
version: 1
url: https://patchwork.kernel.org/series/1188698/