From: Sunil Mushran <sunil.mushran@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] Initialize max_slots early
Date: Mon, 11 Oct 2010 12:09:33 -0700 [thread overview]
Message-ID: <4CB360ED.10507@oracle.com> (raw)
In-Reply-To: <AANLkTinGe9j+NnKh9ftHH1po1ZSoaE_AiZ47q2v-+9cT@mail.gmail.com>
Signed-off-by: Sunil Mushran<sunil.mushran@oracle.com>
wow... this bug has been in mainline for 2 years. How come we
did not run into this problem earlier.
On 10/11/2010 10:57 AM, Goldwyn Rodrigues wrote:
> Functions such as ocfs2_recovery_init() make use of osb->max_slots.
> Initialize osb->max_slots early so the functions may use the correct
> value.
>
> Signed-off-by: Goldwyn Rodrigues<rgoldwyn@suse.de>
> ---
> diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
> index fa1be1b..3894c7e 100644
> --- a/fs/ocfs2/super.c
> +++ b/fs/ocfs2/super.c
> @@ -2060,6 +2060,15 @@ static int ocfs2_initialize_super(struct super_block *sb,
> snprintf(osb->dev_str, sizeof(osb->dev_str), "%u,%u",
> MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev));
>
> + osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots);
> + if (osb->max_slots> OCFS2_MAX_SLOTS || osb->max_slots == 0) {
> + mlog(ML_ERROR, "Invalid number of node slots (%u)\n",
> + osb->max_slots);
> + status = -EINVAL;
> + goto bail;
> + }
> + mlog(0, "max_slots for this device: %u\n", osb->max_slots);
> +
> ocfs2_orphan_scan_init(osb);
>
> status = ocfs2_recovery_init(osb);
> @@ -2098,15 +2107,6 @@ static int ocfs2_initialize_super(struct super_block *sb,
> goto bail;
> }
>
> - osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots);
> - if (osb->max_slots> OCFS2_MAX_SLOTS || osb->max_slots == 0) {
> - mlog(ML_ERROR, "Invalid number of node slots (%u)\n",
> - osb->max_slots);
> - status = -EINVAL;
> - goto bail;
> - }
> - mlog(0, "max_slots for this device: %u\n", osb->max_slots);
> -
> osb->slot_recovery_generations =
> kcalloc(osb->max_slots, sizeof(*osb->slot_recovery_generations),
> GFP_KERNEL);
>
>
next prev parent reply other threads:[~2010-10-11 19:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-11 17:57 [Ocfs2-devel] [PATCH] Initialize max_slots early Goldwyn Rodrigues
2010-10-11 19:09 ` Sunil Mushran [this message]
2010-10-11 20:57 ` Joel Becker
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=4CB360ED.10507@oracle.com \
--to=sunil.mushran@oracle.com \
--cc=ocfs2-devel@oss.oracle.com \
/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).