From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755337Ab0IPSdm (ORCPT ); Thu, 16 Sep 2010 14:33:42 -0400 Received: from 0122700014.0.fullrate.dk ([95.166.99.235]:54342 "EHLO kernel.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753139Ab0IPSdl (ORCPT ); Thu, 16 Sep 2010 14:33:41 -0400 Message-ID: <4C926303.9090206@kernel.dk> Date: Thu, 16 Sep 2010 20:33:39 +0200 From: Jens Axboe MIME-Version: 1.0 To: Jan Kara CC: linux-kernel@vger.kernel.org, tj@kernel.org Subject: Re: [PATCH] block: Fix race during disk initialization References: <1284661217-22783-1-git-send-email-jack@suse.cz> In-Reply-To: <1284661217-22783-1-git-send-email-jack@suse.cz> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Signed-off-by: Jan Kara > --- > 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? -- Jens Axboe