Patchwork [4/5] ext4 : Add missing posix_acl_release() in ext4_xattr_set_acl() in error path.

login
register
mail settings
Submitter Manish Katiyar
Date April 25, 2011, 12:21 a.m.
Message ID <BANLkTinTywZpzNEk9oMztAfLWoFVJuLAfQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/92688/
State Superseded
Headers show

Comments

Manish Katiyar - April 25, 2011, 12:21 a.m.
On Sun, Apr 24, 2011 at 5:18 PM, Manish Katiyar <mkatiyar@gmail.com> wrote:
> This patch fixes the following.
>
> a) Incase journal transaction allocation fails due to ENOMEM don't
> call ext4_std_error() since it will
>    remount 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 <mkatiyar@gmail.com>
> ---
>  fs/ext4/acl.c |    7 ++++---
>  1 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)
>                                EXT4_DATA_TRANS_BLOCKS(inode->i_sb));
>                if (IS_ERR(handle)) {
>                        error = PTR_ERR(handle);
> -                       ext4_std_error(inode->i_sb, error);
>                        goto out;
>                }
>                error = 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,
>
>  retry:
>        handle = ext4_journal_start(inode, EXT4_DATA_TRANS_BLOCKS(inode->i_sb));
> -       if (IS_ERR(handle))
> -               return PTR_ERR(handle);
> +       if (IS_ERR(handle)) {
> +               error = PTR_ERR(handle);
> +               goto release_and_out;
> +       }
>        error = ext4_set_acl(handle, inode, type, acl);
>        ext4_journal_stop(handle);
>        if (error == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
> --
> 1.7.1
>
> --
> Thanks -
> Manish
>

Patch

From 390c5add3d4c0defa4acbebc85fb741b21495f09 Mon Sep 17 00:00:00 2001
From: Manish Katiyar <mkatiyar@gmail.com>
Date: Sun, 24 Apr 2011 01:38:24 -0700
Subject: [PATCH 4/5] This patch fixes the following. a) Incase journal transaction allocation fails due to ENOMEM don't call ext4_std_error() since it will remount 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 <mkatiyar@gmail.com>
---
 fs/ext4/acl.c |    7 ++++---
 1 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)
 				EXT4_DATA_TRANS_BLOCKS(inode->i_sb));
 		if (IS_ERR(handle)) {
 			error = PTR_ERR(handle);
-			ext4_std_error(inode->i_sb, error);
 			goto out;
 		}
 		error = 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,
 
 retry:
 	handle = ext4_journal_start(inode, EXT4_DATA_TRANS_BLOCKS(inode->i_sb));
-	if (IS_ERR(handle))
-		return PTR_ERR(handle);
+	if (IS_ERR(handle)) {
+		error = PTR_ERR(handle);
+		goto release_and_out;
+	}
 	error = ext4_set_acl(handle, inode, type, acl);
 	ext4_journal_stop(handle);
 	if (error == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
-- 
1.7.1