Re: [PATCH] block: Fix race during disk initialization

From: Jan Kara
Date: Thu Sep 16 2010 - 18:15:16 EST


On Thu 16-09-10 20:33:39, Jens Axboe wrote:
> On 2010-09-16 20:20, Jan Kara wrote:
> > When a new disk is being discovered, add_disk() first ties the bdev to gendisk
> > (via register_disk()->blkdev_get()) and only after that calls
> > bdi_register_bdev(). Because register_disk() also creates disk's kobject, it
> > can happen that userspace manages to open and modify the device's data (or
> > inode) before its BDI is properly initialized leading to a warning in
> > __mark_inode_dirty().
> >
> > Fix the problem by registering BDI early enough.
> >
> > This patch addresses https://bugzilla.kernel.org/show_bug.cgi?id=16312
> >
> > Reported-by: Larry Finger <Larry.Finger@xxxxxxxxxxxx>
> > Signed-off-by: Jan Kara <jack@xxxxxxx>
> > ---
> > block/genhd.c | 6 ++++--
> > 1 files changed, 4 insertions(+), 2 deletions(-)
> >
> > Jens, would you consider merging this fix? The kernel boots with it but
> > I'm not too familiar with this area of kernel so there can be something subtle
> > I've missed. So please review. Thanks.
>
> It looks sane. How about we add it to the .37 lineup and mark it for
> stable backport?
OK with me. Thanks.

Honza
--
Jan Kara <jack@xxxxxxx>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/