From mboxrd@z Thu Jan 1 00:00:00 1970 From: Namjae Jeon Subject: Re: [PATCH] udf: Fix deadlock when converting file from in-ICB one to normal one Date: Sat, 10 Dec 2011 13:40:53 +0900 Message-ID: References: <1323483097-24210-1-git-send-email-jack@suse.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: LKML , linux-fsdevel@vger.kernel.org, Matthias Matiak To: Jan Kara Return-path: Received: from mail-bw0-f46.google.com ([209.85.214.46]:42348 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752031Ab1LJEkz convert rfc822-to-8bit (ORCPT ); Fri, 9 Dec 2011 23:40:55 -0500 In-Reply-To: <1323483097-24210-1-git-send-email-jack@suse.cz> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 2011/12/10 Jan Kara : > During BKL removal, conversion of files from in-ICB format to normal = format got > broken. We call ->writepage with i_data_sem held but udf_get_block() = also > acquires i_data_sem thus creating A-A deadlock. > > We fix the problem by dropping i_data_sem before calling ->writepage(= ) which is > safe since i_mutex still protects us against any changes in the file.= Also fix > pagelock - i_data_sem lock inversion in udf_expand_file_adinicb() by = dropping > i_data_sem before calling find_or_create_page(). > > Reported-by: Matthias Matiak > Signed-off-by: Jan Kara Reviewed-by: Namjae Jeon > --- > =C2=A0fs/udf/file.c =C2=A0| =C2=A0 =C2=A06 +++--- > =C2=A0fs/udf/inode.c | =C2=A0 20 +++++++++++++++++--- > =C2=A02 files changed, 20 insertions(+), 6 deletions(-) > > =C2=A0I plan to merge this fix through my tree soon. > > +/* > + * Expand file stored in ICB to a normal one-block-file > + * > + * This function requires i_data_sem for writing and releases it. > + * This function requires i_mutex held > + */ > =C2=A0int udf_expand_file_adinicb(struct inode *inode) > =C2=A0{ > =C2=A0 =C2=A0 =C2=A0 =C2=A0struct page *page; > @@ -171,6 +177,11 @@ int udf_expand_file_adinicb(struct inode *inode) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0mark_inode_dir= ty(inode); up_write(&iinfo->i_data_sem); Hi Jan. I do not know if that helps, Would it need here ? Thanks. > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 0; > =C2=A0 =C2=A0 =C2=A0 =C2=A0} > -- > To unsubscribe from this list: send the line "unsubscribe linux-kerne= l" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at =C2=A0http://vger.kernel.org/majordomo-info.ht= ml > Please read the FAQ at =C2=A0http://www.tux.org/lkml/ -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html