From: Jan Kara Subject: Re: [PATCH] udf: Fix deadlock in udf_release_file() Date: Mon, 20 Feb 2012 23:22:35 +0100 Message-ID: <20120220222235.GA32708@quack.suse.cz> References: <1329756840-20134-1-git-send-email-jack@suse.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Jan Kara , linux-fsdevel@vger.kernel.org, Al Viro , stable@vger.kernel.org To: Namjae Jeon Return-path: Received: from cantor2.suse.de ([195.135.220.15]:40477 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753800Ab2BTWWh (ORCPT ); Mon, 20 Feb 2012 17:22:37 -0500 Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue 21-02-12 04:14:50, Namjae Jeon wrote: > 2012/2/21 Jan Kara : > > udf_release_file() can be called from munmap() path with mmap_sem h= eld. =A0Thus > > we cannot take i_mutex there because that ranks above mmap_sem. Luc= kily, > > i_mutex is not needed in udf_release_file() anymore since protectio= n by > > i_data_sem is enough to protect from races with write and truncate. > > > > Reported-by: Al Viro > > Signed-off-by: Jan Kara > HI. Jan. > Looks reasonable to me. And I think that this patch should be added i= n > stable kernel. > So I add cc: stable@vger.kernel.org. Good point. Added. > Reviewed-by: Namjae Jeon Thanks. Honza > > --- > > =A0fs/udf/file.c | =A0 =A02 -- > > =A01 files changed, 0 insertions(+), 2 deletions(-) > > > > =A0If noone objects, I will add this patch to my tree and push it t= o Linus. > > > > diff --git a/fs/udf/file.c b/fs/udf/file.c > > index dca0c38..d567b84 100644 > > --- a/fs/udf/file.c > > +++ b/fs/udf/file.c > > @@ -201,12 +201,10 @@ out: > > =A0static int udf_release_file(struct inode *inode, struct file *fi= lp) > > =A0{ > > =A0 =A0 =A0 =A0if (filp->f_mode & FMODE_WRITE) { > > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 mutex_lock(&inode->i_mutex); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0down_write(&UDF_I(inode)->i_data_sem= ); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0udf_discard_prealloc(inode); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0udf_truncate_tail_extent(inode); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0up_write(&UDF_I(inode)->i_data_sem); > > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 mutex_unlock(&inode->i_mutex); > > =A0 =A0 =A0 =A0} > > =A0 =A0 =A0 =A0return 0; > > =A0} > > -- > > 1.7.1 > > > > -- > > To unsubscribe from this list: send the line "unsubscribe linux-fsd= evel" in > > the body of a message to majordomo@vger.kernel.org > > More majordomo info at =A0http://vger.kernel.org/majordomo-info.htm= l --=20 Jan Kara SUSE Labs, CR -- 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