[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZG8vT8f0mTjTpNgP@infradead.org>
Date: Thu, 25 May 2023 02:50:07 -0700
From: "hch@...radead.org" <hch@...radead.org>
To: Vincent Whitchurch <Vincent.Whitchurch@...s.com>
Cc: "hch@...radead.org" <hch@...radead.org>, kernel <kernel@...s.com>,
"vigneshr@...com" <vigneshr@...com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"miquel.raynal@...tlin.com" <miquel.raynal@...tlin.com>,
"richard@....at" <richard@....at>,
"linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>
Subject: Re: [PATCH 2/2] ubi: block: Fix deadlock on remove
On Wed, May 24, 2023 at 01:36:39PM +0000, Vincent Whitchurch wrote:
> On Tue, 2023-05-23 at 23:04 -0700, Christoph Hellwig wrote:
> > If you imlement ->free_disk, the list_del and kfree can move into
> > that, and we don't really care if a new opener raced with the delete.
>
> Moving the kfree() to ->free_disk() works, but the list_del() still
> needs to be in ubiblock_remove() since otherwise ubiblock_remove() could
> attempt to remove the same device twice.
Or we'd still need your removed flag..
> I assumed the current code really wanted to prevent new openers racing
> with delete, but if that is not needed, yes, we don't need to add a
> ->removing flag if we move the kfree() to ->free_disk(). I'll re-spin
> this based on your suggestions. Thanks.
I think in the past we always had to protect against removals of live
devices because handling of hot removes sucked so bad, both in drivers
and in the block layer itself. With some newer infrastructure including
the ->free_disk method this can now be handled sanely.
Powered by blists - more mailing lists