[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTiku46htAypEN7QNN=UZuRETKGnHJQ8cxt3kYPJg@mail.gmail.com>
Date: Sun, 16 Jan 2011 10:05:08 -0800
From: Manish Katiyar <mkatiyar@...il.com>
To: Andreas Dilger <adilger@...ger.ca>
Cc: "Theodore Ts'o" <tytso@....edu>, ext4 <linux-ext4@...r.kernel.org>,
mkatiyar@...il.com
Subject: Re: [PATCH] ext4: Fix missing iput for root inode in case of all
failed mount paths.
On Sun, Jan 16, 2011 at 8:20 AM, Andreas Dilger <adilger@...ger.ca> wrote:
> Why not just put the iput() at failed_mount4() instead of spread around the code?
Thanks Andreas, Here is the updated patch.
Signed-off-by: Manish Katiyar <mkatiyar@...il.com>
---
fs/ext4/super.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index cb10a06..8fa53e9 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3522,17 +3522,16 @@ no_journal:
if (IS_ERR(root)) {
ext4_msg(sb, KERN_ERR, "get root inode failed");
ret = PTR_ERR(root);
+ root = NULL;
goto failed_mount4;
}
if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {
- iput(root);
ext4_msg(sb, KERN_ERR, "corrupt root inode, run e2fsck");
goto failed_mount4;
}
sb->s_root = d_alloc_root(root);
if (!sb->s_root) {
ext4_msg(sb, KERN_ERR, "get root dentry failed");
- iput(root);
ret = -ENOMEM;
goto failed_mount4;
}
@@ -3648,6 +3647,8 @@ cantfind_ext4:
goto failed_mount;
failed_mount4:
+ iput(root);
+ sb->s_root = NULL;
ext4_msg(sb, KERN_ERR, "mount failed");
destroy_workqueue(EXT4_SB(sb)->dio_unwritten_wq);
failed_mount_wq:
--
1.7.1
>
> Cheers, Andreas
>
> On 2011-01-16, at 0:30, Manish Katiyar <mkatiyar@...il.com> wrote:
>
>> Fix missing iput for root inode in case of all failed mount paths.
>> Fixes bug#26752
>>
>> Signed-off-by: Manish Katiyar <mkatiyar@...il.com>
>>
>> ---
>> fs/ext4/super.c | 8 +++++++-
>> 1 files changed, 7 insertions(+), 1 deletions(-)
>>
>> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
>> index cb10a06..9570fcc 100644
>> --- a/fs/ext4/super.c
>> +++ b/fs/ext4/super.c
>> @@ -3587,6 +3587,7 @@ no_journal:
>> if (err) {
>> ext4_msg(sb, KERN_ERR, "failed to initialize system "
>> "zone (%d)", err);
>> + iput(root);
>> goto failed_mount4;
>> }
>>
>> @@ -3595,12 +3596,15 @@ no_journal:
>> if (err) {
>> ext4_msg(sb, KERN_ERR, "failed to initialize mballoc (%d)",
>> err);
>> + iput(root);
>> goto failed_mount4;
>> }
>>
>> err = ext4_register_li_request(sb, first_not_zeroed);
>> - if (err)
>> + if (err) {
>> + iput(root);
>> goto failed_mount4;
>> + }
>>
>> sbi->s_kobj.kset = ext4_kset;
>> init_completion(&sbi->s_kobj_unregister);
>> @@ -3609,6 +3613,7 @@ no_journal:
>> if (err) {
>> ext4_mb_release(sb);
>> ext4_ext_release(sb);
>> + iput(root);
>> goto failed_mount4;
>> };
>>
>> @@ -3648,6 +3653,7 @@ cantfind_ext4:
>> goto failed_mount;
>>
>> failed_mount4:
>> + sb->s_root = NULL;
>> ext4_msg(sb, KERN_ERR, "mount failed");
>> destroy_workqueue(EXT4_SB(sb)->dio_unwritten_wq);
>> failed_mount_wq:
>> --
>> 1.7.1
>>
>>
>> --
>> Thanks -
>> Manish
>> ==================================
>> [$\*.^ -- I miss being one of them
>> ==================================
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
>> the body of a message to majordomo@...r.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Thanks -
Manish
==================================
[$\*.^ -- I miss being one of them
==================================
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists