linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Manish Katiyar <mkatiyar@gmail.com>
To: Andreas Dilger <adilger@dilger.ca>
Cc: "Theodore Ts'o" <tytso@mit.edu>,
	ext4 <linux-ext4@vger.kernel.org>,
	mkatiyar@gmail.com
Subject: Re: [PATCH] ext4: Fix missing iput for root inode in case of all failed mount paths.
Date: Sat, 29 Jan 2011 21:40:34 -0800	[thread overview]
Message-ID: <AANLkTim0XZe2=3AWw4Ydb8F7BQGCf+=FyjKoyadc+3yw@mail.gmail.com> (raw)
In-Reply-To: <AANLkTiku46htAypEN7QNN=UZuRETKGnHJQ8cxt3kYPJg@mail.gmail.com>

On Sun, Jan 16, 2011 at 10:05 AM, Manish Katiyar <mkatiyar@gmail.com> wrote:
> On Sun, Jan 16, 2011 at 8:20 AM, Andreas Dilger <adilger@dilger.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@gmail.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@gmail.com> wrote:
>>
>>> Fix missing iput for root inode in case of all failed mount paths.
>>> Fixes bug#26752
>>>
>>> Signed-off-by: Manish Katiyar <mkatiyar@gmail.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:

Hi Ted,

Any feedback on this ?

-- 
Thanks -
Manish
--
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

  reply	other threads:[~2011-01-30  5:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-16  7:30 [PATCH] ext4: Fix missing iput for root inode in case of all failed mount paths Manish Katiyar
2011-01-16 16:20 ` Andreas Dilger
2011-01-16 18:05   ` Manish Katiyar
2011-01-30  5:40     ` Manish Katiyar [this message]
2011-02-07 23:23       ` Ted Ts'o
2011-02-07 23:31         ` Manish Katiyar
2011-02-26 21:35           ` Manish Katiyar
2011-02-28  1:45             ` Ted Ts'o
2011-02-28  4:19               ` Manish Katiyar
2011-07-06 22:54     ` Andreas Dilger
2011-07-10 19:11       ` Manish Katiyar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTim0XZe2=3AWw4Ydb8F7BQGCf+=FyjKoyadc+3yw@mail.gmail.com' \
    --to=mkatiyar@gmail.com \
    --cc=adilger@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).