From: "hch@lst.de" <hch@lst.de>
To: Gulam Mohamed <gulam.mohamed@oracle.com>
Cc: "hch@lst.de" <hch@lst.de>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"yukuai1@huaweicloud.com" <yukuai1@huaweicloud.com>,
"axboe@kernel.dk" <axboe@kernel.dk>
Subject: Re: [PATCH V6 for-6.11/block] loop: Fix a race between loop detach and loop open
Date: Tue, 2 Jul 2024 17:50:20 +0200 [thread overview]
Message-ID: <20240702155020.GB1037@lst.de> (raw)
In-Reply-To: <IA1PR10MB7240DE46976A3B027DE5484998D22@IA1PR10MB7240.namprd10.prod.outlook.com>
Hi Gulam,
On Sun, Jun 30, 2024 at 10:11:14PM +0000, Gulam Mohamed wrote:
> With our latest version of the patch V6, the "kernel robot test" failed
> in the ioctl_loop06 test (LTP tests) as in below mail.
> the reason for the failure is, the deferring of the "detach" loop
> device to release function. The test opens the loop device, sends
> LOOP_SET_BLOCK_SIZE and LOOP_CONFIGURE commands and in between that,
> it will also detach the loop device. At the end of the test, while
> cleanup, it will close the loop device. As we deferred the detach to
> last close, the detach will be at the end only but before that we are
> setting the lo_state to Lo_rundown. This setting of Lo_rundown we are
> doing in the beginning because, there was another LTP test case failed
> earlier due to the same reason.
>
> So, when the LOOP_CONFIGURE was sent, the loop device was still in
> Lo_rundown state (Lo_unbound will be set after detach in
> __loop_clr_fd()) due to which kernel returned the EBUSY error causing
> the test to fail.
Before we'd end up in Lo_unbound toward the end of __loop_clr_fd
if there was a single opener.
> I have noticed that a good number of test cases are having a behaviour
> that it will send different loop commands and in between the detach
> command also, with only a single open. And close happens at the end.
> Due to this, I think a couple of test cases needs to be modified.
>
> Now, as per my understanding, we have two options here:
>
> 1. Continue with this kernel patch and modify few test cases to
> accommodate this new kernel behaviour
That would be my preference. Any code that is doing a clear_fd
and then tries to configure it again is prone to races vs other
openers. It also does not seem very useful outside of test code.
But if we end up breaking real code and not test cases we might have
to go and bring it back.
next prev parent reply other threads:[~2024-07-02 15:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-18 16:40 [PATCH V6 for-6.11/block] loop: Fix a race between loop detach and loop open Gulam Mohamed
2024-06-19 8:16 ` Christoph Hellwig
2024-06-19 8:21 ` Gulam Mohamed
2024-06-19 8:27 ` Christoph Hellwig
2024-06-19 9:00 ` Gulam Mohamed
2024-06-27 20:13 ` Gulam Mohamed
2024-06-27 22:11 ` Jens Axboe
2024-06-28 9:25 ` Gulam Mohamed
2024-06-27 22:11 ` Jens Axboe
2024-06-28 5:39 ` kernel test robot
2024-06-30 22:11 ` Gulam Mohamed
2024-07-02 15:50 ` hch [this message]
2024-07-05 19:51 ` Gulam Mohamed
2024-07-09 9:09 ` Gulam Mohamed
2024-07-09 11:21 ` hch
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=20240702155020.GB1037@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=gulam.mohamed@oracle.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=yukuai1@huaweicloud.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