linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Uday Shankar <ushankar@purestorage.com>
To: Ming Lei <ming.lei@redhat.com>
Cc: Shuah Khan <shuah@kernel.org>, Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] ublk: improve handling of saturated queues when ublk server exits
Date: Wed, 26 Mar 2025 17:08:19 -0600	[thread overview]
Message-ID: <Z+SI4x+0J52rCJpN@dev-ushankar.dev.purestorage.com> (raw)
In-Reply-To: <Z+RN+CPnWO69aJD5@dev-ushankar.dev.purestorage.com>

On Wed, Mar 26, 2025 at 12:56:56PM -0600, Uday Shankar wrote:
> 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

Actually this is the only issue I'm seeing - after patching this up in
ublksrv, make T=generic test appears to pass - I don't see any logs
indicating failures, and no kernel panics.

So the question is, does this patch break existing ublk servers? It does
break ublksrv as shown above, but I think one could argue that the above
code is just testing for file existence, and it's a bit weird to do that
by opening and closing the file (especially given that it's a device
special file). It can be patched to just use access or something
instead.


  reply	other threads:[~2025-03-26 23:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-25 22:19 [PATCH 0/4] ublk: improve handling of saturated queues when ublk server exits Uday Shankar
2025-03-25 22:19 ` [PATCH 1/4] selftests: ublk: kublk: use ioctl-encoded opcodes Uday Shankar
2025-03-25 22:26   ` Uday Shankar
2025-03-26  3:07   ` Ming Lei
2025-03-25 22:19 ` [PATCH 2/4] selftests: ublk: kublk: fix an error log line Uday Shankar
2025-03-26  3:08   ` Ming Lei
2025-03-25 22:19 ` [PATCH 3/4] selftests: ublk: kublk: ignore SIGCHLD Uday Shankar
2025-03-26  3:23   ` Ming Lei
2025-03-26 17:17     ` Uday Shankar
2025-03-25 22:19 ` [PATCH 4/4] ublk: improve handling of saturated queues when ublk server exits Uday Shankar
2025-03-26  5:38   ` Ming Lei
2025-03-26 17:54     ` Uday Shankar
2025-03-26 18:56       ` Uday Shankar
2025-03-26 23:08         ` Uday Shankar [this message]
2025-03-27  1:38           ` Ming Lei
2025-03-27  1:23       ` Ming Lei
2025-03-31 23:17         ` Uday Shankar
2025-04-02  3:59           ` Ming Lei
2025-04-02 19:41             ` Uday Shankar
2025-03-27  2:06   ` Ming Lei

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=Z+SI4x+0J52rCJpN@dev-ushankar.dev.purestorage.com \
    --to=ushankar@purestorage.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=shuah@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).