@@ -199,24 +199,36 @@ managing and controlling ublk devices with help of several control commands:
199
199
200
200
- user recovery feature description
201
201
202
- Two new features are added for user recovery: ``UBLK_F_USER_RECOVERY `` and
203
- ``UBLK_F_USER_RECOVERY_REISSUE ``.
204
-
205
- With ``UBLK_F_USER_RECOVERY `` set, after one ubq_daemon(ublk server's io
202
+ Three new features are added for user recovery: ``UBLK_F_USER_RECOVERY ``,
203
+ ``UBLK_F_USER_RECOVERY_REISSUE ``, and ``UBLK_F_USER_RECOVERY_FAIL_IO ``. To
204
+ enable recovery of ublk devices after the ublk server exits, the ublk server
205
+ should specify the ``UBLK_F_USER_RECOVERY `` flag when creating the device. The
206
+ ublk server may additionally specify at most one of
207
+ ``UBLK_F_USER_RECOVERY_REISSUE `` and ``UBLK_F_USER_RECOVERY_FAIL_IO `` to
208
+ modify how I/O is handled while the ublk server is dying/dead (this is called
209
+ the ``nosrv `` case in the driver code).
210
+
211
+ With just ``UBLK_F_USER_RECOVERY `` set, after one ubq_daemon(ublk server's io
206
212
handler) is dying, ublk does not delete ``/dev/ublkb* `` during the whole
207
213
recovery stage and ublk device ID is kept. It is ublk server's
208
214
responsibility to recover the device context by its own knowledge.
209
215
Requests which have not been issued to userspace are requeued. Requests
210
216
which have been issued to userspace are aborted.
211
217
212
- With ``UBLK_F_USER_RECOVERY_REISSUE `` set, after one ubq_daemon(ublk
213
- server's io handler) is dying, contrary to ``UBLK_F_USER_RECOVERY ``,
218
+ With ``UBLK_F_USER_RECOVERY_REISSUE `` additionally set, after one ubq_daemon
219
+ (ublk server's io handler) is dying, contrary to ``UBLK_F_USER_RECOVERY ``,
214
220
requests which have been issued to userspace are requeued and will be
215
221
re-issued to the new process after handling ``UBLK_CMD_END_USER_RECOVERY ``.
216
222
``UBLK_F_USER_RECOVERY_REISSUE `` is designed for backends who tolerate
217
223
double-write since the driver may issue the same I/O request twice. It
218
224
might be useful to a read-only FS or a VM backend.
219
225
226
+ With ``UBLK_F_USER_RECOVERY_FAIL_IO `` additionally set, after the ublk server
227
+ exits, requests which have issued to userspace are failed, as are any
228
+ subsequently issued requests. Applications continuously issuing I/O against
229
+ devices with this flag set will see a stream of I/O errors until a new ublk
230
+ server recovers the device.
231
+
220
232
Unprivileged ublk device is supported by passing ``UBLK_F_UNPRIVILEGED_DEV ``.
221
233
Once the flag is set, all control commands can be sent by unprivileged
222
234
user. Except for command of ``UBLK_CMD_ADD_DEV ``, permission check on
0 commit comments