[PATCH 37/44] block: switch partition lookup to use struct block_device

Jan Kara jack at suse.cz
Fri Nov 27 12:26:40 EST 2020


On Fri 27-11-20 16:36:15, Christoph Hellwig wrote:
> On Fri, Nov 27, 2020 at 01:45:37PM +0100, Jan Kara wrote:
> > > At this point the hd_struct is already allocated together with the
> > > block_device, and thus only freed after the last block_device reference
> > > goes away plus the inode freeing RCU grace period.  So the device model
> > > ref to part is indeed gone, but that simply does not matter any more.
> > 
> > Well, but once device model ref to part is gone, we're going to free the
> > bdev inode ref as well. Thus there's nothing which pins the bdev containing
> > hd_struct?
> > 
> > But now as I'm thinking about it you later switch the device model reference
> > to just pure inode reference and use igrab() which will reliably return
> > NULL if the inode is on it's way to be destroyed so probably we are safe in
> > the final state.
> 
> igrab always succeeds.  But we should switch to a tryget.

No. If the inode is I_FREEING or I_WILL_FREE, it will return NULL...

								Honza

-- 
Jan Kara <jack at suse.com>
SUSE Labs, CR



More information about the linux-mtd mailing list