Re: [PATCH 4/4] ublk: improve handling of saturated queues when ublk server exits
From: Uday Shankar
Date: Wed Mar 26 2025 - 14:57:06 EST
On Wed, Mar 26, 2025 at 11:54:16AM -0600, Uday Shankar wrote:
> > ublk_abort_requests() should be called only in case of queue dying,
> > since ublk server may open & close the char device multiple times.
>
> Sure that is technically possible, however is any real ublk server doing
> this? Seems like a strange thing to do, and seems reasonable for the
> driver to transition the device to the nosrv state (dead or recovery,
> depending on flags) when the char device is closed, since in this case,
> no one can be handling I/O anymore.
I see ublksrv itself is doing this :(
/* Wait until ublk device is setup by udev */
static void ublksrv_check_dev(const struct ublksrv_ctrl_dev_info *info)
{
unsigned int max_time = 1000000, wait = 0;
char buf[64];
snprintf(buf, 64, "%s%d", "/dev/ublkc", info->dev_id);
while (wait < max_time) {
int fd = open(buf, O_RDWR);
if (fd > 0) {
close(fd);
break;
}
usleep(100000);
wait += 100000;
}
}
This seems related to some failures in ublksrv tests