Patchwork [1/2] ext4: release sysfs kobject when failing to enable quotas on mount

login
register
mail settings
Submitter Theodore Ts'o
Date Jan. 21, 2013, 6:46 a.m.
Message ID <1358750781-5670-1-git-send-email-tytso@mit.edu>
Download mbox | patch
Permalink /patch/214032/
State Accepted
Headers show

Comments

Theodore Ts'o - Jan. 21, 2013, 6:46 a.m.
In addition, print the error returned from ext4_enable_quotas()

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: stable@vger.kernel.org
---
 fs/ext4/super.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
Carlos Maiolino - Jan. 21, 2013, 12:12 p.m.
Looks Good,

Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
> In addition, print the error returned from ext4_enable_quotas()
> 
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
> Cc: stable@vger.kernel.org
> ---
>  fs/ext4/super.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 30651bd..0a6e9d5 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -4015,7 +4015,7 @@ no_journal:
>  	    !(sb->s_flags & MS_RDONLY)) {
>  		err = ext4_enable_quotas(sb);
>  		if (err)
> -			goto failed_mount7;
> +			goto failed_mount8;
>  	}
>  #endif  /* CONFIG_QUOTA */
>  
> @@ -4042,6 +4042,8 @@ cantfind_ext4:
>  		ext4_msg(sb, KERN_ERR, "VFS: Can't find ext4 filesystem");
>  	goto failed_mount;
>  
> +failed_mount8:
> +	kobject_del(&sbi->s_kobj);
>  failed_mount7:
>  	ext4_unregister_li_request(sb);
>  failed_mount6:
> @@ -5012,9 +5014,9 @@ static int ext4_enable_quotas(struct super_block *sb)
>  						DQUOT_USAGE_ENABLED);
>  			if (err) {
>  				ext4_warning(sb,
> -					"Failed to enable quota (type=%d) "
> -					"tracking. Please run e2fsck to fix.",
> -					type);
> +					"Failed to enable quota tracking "
> +					"(type=%d, err=%d). Please run "
> +					"e2fsck to fix.", type, err);
>  				return err;
>  			}
>  		}
> -- 
> 1.7.12.rc0.22.gcdd159b
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 30651bd..0a6e9d5 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4015,7 +4015,7 @@  no_journal:
 	    !(sb->s_flags & MS_RDONLY)) {
 		err = ext4_enable_quotas(sb);
 		if (err)
-			goto failed_mount7;
+			goto failed_mount8;
 	}
 #endif  /* CONFIG_QUOTA */
 
@@ -4042,6 +4042,8 @@  cantfind_ext4:
 		ext4_msg(sb, KERN_ERR, "VFS: Can't find ext4 filesystem");
 	goto failed_mount;
 
+failed_mount8:
+	kobject_del(&sbi->s_kobj);
 failed_mount7:
 	ext4_unregister_li_request(sb);
 failed_mount6:
@@ -5012,9 +5014,9 @@  static int ext4_enable_quotas(struct super_block *sb)
 						DQUOT_USAGE_ENABLED);
 			if (err) {
 				ext4_warning(sb,
-					"Failed to enable quota (type=%d) "
-					"tracking. Please run e2fsck to fix.",
-					type);
+					"Failed to enable quota tracking "
+					"(type=%d, err=%d). Please run "
+					"e2fsck to fix.", type, err);
 				return err;
 			}
 		}