From: Manish Katiyar Subject: Re: [PATCH 4/5] ext4 : Add missing posix_acl_release() in ext4_xattr_set_acl() in error path. Date: Sun, 24 Apr 2011 17:21:05 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=0016e64bd5641ac13d04a1b3300b Cc: "Theodore Ts'o" , Jan Kara , mkatiyar@gmail.com To: ext4 Return-path: Received: from mail-qw0-f46.google.com ([209.85.216.46]:53558 "EHLO mail-qw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757834Ab1DYAVZ (ORCPT ); Sun, 24 Apr 2011 20:21:25 -0400 Received: by qwk3 with SMTP id 3so799127qwk.19 for ; Sun, 24 Apr 2011 17:21:25 -0700 (PDT) In-Reply-To: Sender: linux-ext4-owner@vger.kernel.org List-ID: --0016e64bd5641ac13d04a1b3300b Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Sun, Apr 24, 2011 at 5:18 PM, Manish Katiyar wrote: > This patch fixes the following. > > a) Incase journal transaction allocation fails due to ENOMEM don't > call ext4_std_error() since it will > =A0 =A0remount the fs as readonly and logs the message in kernel log. > b) Call posix_acl_release() incase journal allocation fails in case of > error paths. > > > Signed-off-by: Manish Katiyar > --- > =A0fs/ext4/acl.c | =A0 =A07 ++++--- > =A01 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/fs/ext4/acl.c b/fs/ext4/acl.c > index 21eacd7..0c98710 100644 > --- a/fs/ext4/acl.c > +++ b/fs/ext4/acl.c > @@ -354,7 +354,6 @@ ext4_acl_chmod(struct inode *inode) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0EXT4_DATA_= TRANS_BLOCKS(inode->i_sb)); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (IS_ERR(handle)) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0error =3D PTR_ERR(handle); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ext4_std_error(inode->i_sb,= error); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0goto out; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0error =3D ext4_set_acl(handle, inode, ACL_= TYPE_ACCESS, clone); > @@ -450,8 +449,10 @@ ext4_xattr_set_acl(struct dentry *dentry, const > char *name, const void *value, > > =A0retry: > =A0 =A0 =A0 =A0handle =3D ext4_journal_start(inode, EXT4_DATA_TRANS_BLOCK= S(inode->i_sb)); > - =A0 =A0 =A0 if (IS_ERR(handle)) > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 return PTR_ERR(handle); > + =A0 =A0 =A0 if (IS_ERR(handle)) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D PTR_ERR(handle); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto release_and_out; > + =A0 =A0 =A0 } > =A0 =A0 =A0 =A0error =3D ext4_set_acl(handle, inode, type, acl); > =A0 =A0 =A0 =A0ext4_journal_stop(handle); > =A0 =A0 =A0 =A0if (error =3D=3D -ENOSPC && ext4_should_retry_alloc(inode-= >i_sb, &retries)) > -- > 1.7.1 > > -- > Thanks - > Manish > --=20 Thanks - Manish --0016e64bd5641ac13d04a1b3300b Content-Type: text/x-patch; charset=US-ASCII; name="0004-This-patch-fixes-the-following.-a-Incase-journal-tra.patch" Content-Disposition: attachment; filename="0004-This-patch-fixes-the-following.-a-Incase-journal-tra.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gmwnvfhf0 RnJvbSAzOTBjNWFkZDNkNGMwZGVmYTRhY2JlYmM4NWZiNzQxYjIxNDk1ZjA5IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBNYW5pc2ggS2F0aXlhciA8bWthdGl5YXJAZ21haWwuY29tPgpE YXRlOiBTd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