From: Song Liu <songliubraving@fb.com>
To: linux-raid@vger.kernel.org
Cc: Song Liu <songliubraving@fb.com>,
shli@fb.com, neilb@suse.com, kernel-team@fb.com,
dan.j.williams@intel.com, hch@infradead.org,
jes.sorensen@gmail.com
Subject: [PATCH] mdadm: handle super == NULL case in avail_size1
Date: Thu, 31 Aug 2017 10:37:51 -0700 [thread overview]
Message-ID: <20170831173751.2910909-1-songliubraving@fb.com> (raw)
Summary:
Handling super == NULL case in avail_size1() was removed a while
back. However, it is still useful in the following stack:
avail_size1() with st->sb == NULL
array_try_spare() with st == NULL
try_spare() with st == NULL
Incremental() with st == NULL
This patch adds the handling of super == NULL back to avail_size1().
Signed-off-by: Song Liu <songliubraving@fb.com>
---
super1.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/super1.c b/super1.c
index f6a1045..5e8d967 100644
--- a/super1.c
+++ b/super1.c
@@ -2340,7 +2340,9 @@ static __u64 avail_size1(struct supertype *st, __u64 devsize,
if (devsize < 24)
return 0;
- if (__le32_to_cpu(super->feature_map) & MD_FEATURE_BITMAP_OFFSET) {
+ if (!super)
+ bmspace = choose_bm_space(devsize);
+ else if (__le32_to_cpu(super->feature_map) & MD_FEATURE_BITMAP_OFFSET) {
/* hot-add. allow for actual size of bitmap */
struct bitmap_super_s *bsb;
bsb = (struct bitmap_super_s *)(((char*)super)+MAX_SB_SIZE);
@@ -2350,7 +2352,7 @@ static __u64 avail_size1(struct supertype *st, __u64 devsize,
}
/* Allow space for bad block log */
- if (super->bblog_size)
+ if (super && super->bblog_size)
bbspace = __le16_to_cpu(super->bblog_size);
if (st->minor_version < 0)
--
2.9.5
next reply other threads:[~2017-08-31 17:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-31 17:37 Song Liu [this message]
2017-08-31 23:36 ` [PATCH] mdadm: handle super == NULL case in avail_size1 NeilBrown
2017-08-31 23:46 ` Song Liu
2017-09-01 0:21 ` NeilBrown
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=20170831173751.2910909-1-songliubraving@fb.com \
--to=songliubraving@fb.com \
--cc=dan.j.williams@intel.com \
--cc=hch@infradead.org \
--cc=jes.sorensen@gmail.com \
--cc=kernel-team@fb.com \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.com \
--cc=shli@fb.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.