Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:Update
mdadm.5365
0206-super1-add-more-checks-for-NodeNumUpdate-o...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0206-super1-add-more-checks-for-NodeNumUpdate-option.patch of Package mdadm.5365
From 45a87c2f31335a759190dff663a881bc78ca5443 Mon Sep 17 00:00:00 2001 From: Guoqing Jiang <gqjiang@suse.com> Date: Wed, 11 May 2016 17:31:36 +0800 Subject: [PATCH 272/359] super1: add more checks for NodeNumUpdate option References: bsc#1081910 There are some cases which didn't need to check the space is enough or not for NodeNumUpdate option. 1. for array which does not have clustered bitmap. 2. "--nodes" parameter is 0 (eg, add a disk to clustered raid). 3. if "--nodes" parameter is set to a smaller num than current bms->nodes. Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Coly Li <colyli@suse.de> --- super1.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/super1.c b/super1.c index 6bf9523..879e0d5 100644 --- a/super1.c +++ b/super1.c @@ -2394,9 +2394,25 @@ static int write_bitmap1(struct supertype *st, int fd, enum bitmap_update update return -EINVAL; } - if (bms->version == BITMAP_MAJOR_CLUSTERED && st->nodes <= 1) { - pr_err("Warning: cluster-md at least needs two nodes\n"); - return -EINVAL; + if (bms->version == BITMAP_MAJOR_CLUSTERED) { + if (st->nodes == 1) { + /* the parameter for nodes is not valid */ + pr_err("Warning: cluster-md at least needs two nodes\n"); + return -EINVAL; + } else if (st->nodes == 0) + /* --nodes is not specified */ + break; + else if (__cpu_to_le32(st->nodes) < bms->nodes) { + /* Since the nodes num is not increased, no need to check the space + * is enough or not, just update bms->nodes */ + bms->nodes = __cpu_to_le32(st->nodes); + break; + } + } else { + /* no need to change bms->nodes for other bitmap types */ + if (st->nodes) + pr_err("Warning: --nodes option is only suitable for clustered bitmap\n"); + break; } /* Each node has an independent bitmap, it is necessary to calculate the -- 2.16.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor