Linux block layer
 help / color / mirror / Atom feed
From: Nilay Shroff <nilay@linux.ibm.com>
To: John Garry <john.g.garry@oracle.com>,
	shinichiro.kawasaki@wdc.com, linux-block@vger.kernel.org
Cc: hch@lst.de, linux-nvme@lists.infradead.org, dwagner@suse.de,
	John Garry <john.garry@linux.dev>
Subject: Re: [PATCH v4] nvme/069: add a test for multipath cdev lifetime
Date: Fri, 17 Jul 2026 15:19:02 +0530	[thread overview]
Message-ID: <b8bfb51d-81f1-4bfd-b83b-5cd764473718@linux.ibm.com> (raw)
In-Reply-To: <4a7868c2-a67c-4bfd-bf61-58131a98c97a@oracle.com>

On 7/17/26 2:36 PM, John Garry wrote:
> On 17/07/2026 08:00, Nilay Shroff wrote:
>> On 7/16/26 10: 06 PM, John Garry wrote: > On 16/07/2026 16: 16, Nilay Shroff
>> wrote: >>> +    kill(getppid(), SIGUSR2); >>> +    count = 0; >>> +    for (;;)
>> { >>> +        fd1 = open(argv[1], O_RDONLY); >>>
>>
>>
>> On 7/16/26 10:06 PM, John Garry wrote:
>>> On 16/07/2026 16:16, Nilay Shroff wrote:
>>>>> +    kill(getppid(), SIGUSR2);
>>>>> +    count = 0;
>>>>> +    for (;;) {
>>>>> +        fd1 = open(argv[1], O_RDONLY);
>>>>> +        usleep(500000);
>>>>> +        if (fd1 < 0)
>>>>> +            break;
>>>>
>>>> Does it make sense to check for errno set to ENODEV or ENOENT
>>>> before breaking out here?
>>>
>>> ehh, if the errno is not ENODEV or ENOENT, then how to handle? Would it to fail the test due to unexpected errno?
>>
>> I think yes, something like below:
>>
>> for (;;) {
>>            fd1 = open(argv[1], O_RDONLY);
>>            if (fd1 < 0) {
>>                    if (errno == EINTR)
>>                            continue;
>>
>>                    if (errno == ENOENT || errno == ENODEV)
>>                            break;
>>
>>                    perror("open");
> 
> if fd1 < 0, how is it open? Or maybe this message is too vague...
> 
Yes, if fd1 < 0 then it implies errno is non-zero and device is not
opened. Later we evaluate the error code and take necessary
action.

>>                    return EINVAL;
> 
> So are ENOENT, ENODEV, and EINTR the only expected error codes? Others are just unsupported and we fail the test (if and when we get them), right?

Yes. My thinking is that, apart from EINTR, any failure from open() is an error.
For this particular test, we're specifically waiting until the device node
disappears, so ENOENT or ENODEV indicate the expected condition and we can
break out of the loop and issue the ioctl() on the original fd. Any other
errno would be unexpected, so I'd treat it as a test failure by logging the
error and exiting.

Thanks,
--Nilay


      reply	other threads:[~2026-07-17  9:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16  8:29 [PATCH v4] nvme/069: add a test for multipath cdev lifetime John Garry
2026-07-16 15:16 ` Nilay Shroff
2026-07-16 16:36   ` John Garry
2026-07-17  7:00     ` Nilay Shroff
2026-07-17  9:06       ` John Garry
2026-07-17  9:49         ` Nilay Shroff [this message]

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=b8bfb51d-81f1-4bfd-b83b-5cd764473718@linux.ibm.com \
    --to=nilay@linux.ibm.com \
    --cc=dwagner@suse.de \
    --cc=hch@lst.de \
    --cc=john.g.garry@oracle.com \
    --cc=john.garry@linux.dev \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=shinichiro.kawasaki@wdc.com \
    /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