|
|
2c1b57 |
From d7be7d87366a7f9b190bc4e41ea06f7c9984028e Mon Sep 17 00:00:00 2001
|
|
|
2c1b57 |
From: Jes Sorensen <jsorensen@fb.com>
|
|
|
2c1b57 |
Date: Tue, 16 May 2017 13:59:43 -0400
|
|
|
2c1b57 |
Subject: [RHEL7.5 PATCH 143/169] mdadm: Fixup more broken logical operator
|
|
|
2c1b57 |
formatting
|
|
|
2c1b57 |
|
|
|
2c1b57 |
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
|
|
2c1b57 |
---
|
|
|
2c1b57 |
Assemble.c | 9 ++++-----
|
|
|
2c1b57 |
Grow.c | 16 +++++++++-------
|
|
|
2c1b57 |
Manage.c | 4 ++--
|
|
|
2c1b57 |
Monitor.c | 4 ++--
|
|
|
2c1b57 |
mapfile.c | 4 ++--
|
|
|
2c1b57 |
mdstat.c | 10 ++++++----
|
|
|
2c1b57 |
platform-intel.c | 4 ++--
|
|
|
2c1b57 |
restripe.c | 4 ++--
|
|
|
2c1b57 |
super-ddf.c | 15 +++++++--------
|
|
|
2c1b57 |
super-intel.c | 3 +--
|
|
|
2c1b57 |
util.c | 3 +--
|
|
|
2c1b57 |
11 files changed, 38 insertions(+), 38 deletions(-)
|
|
|
2c1b57 |
|
|
|
2c1b57 |
diff --git a/Assemble.c b/Assemble.c
|
|
|
2c1b57 |
index 1b1905c..afc6d9c 100644
|
|
|
2c1b57 |
--- a/Assemble.c
|
|
|
2c1b57 |
+++ b/Assemble.c
|
|
|
2c1b57 |
@@ -220,8 +220,8 @@ static int select_devices(struct mddev_dev *devlist,
|
|
|
2c1b57 |
pr_err("not a recognisable container: %s\n",
|
|
|
2c1b57 |
devname);
|
|
|
2c1b57 |
tmpdev->used = 2;
|
|
|
2c1b57 |
- } else if (!tst->ss->load_container
|
|
|
2c1b57 |
- || tst->ss->load_container(tst, dfd, NULL)) {
|
|
|
2c1b57 |
+ } else if (!tst->ss->load_container ||
|
|
|
2c1b57 |
+ tst->ss->load_container(tst, dfd, NULL)) {
|
|
|
2c1b57 |
if (report_mismatch)
|
|
|
2c1b57 |
pr_err("no correct container type: %s\n",
|
|
|
2c1b57 |
devname);
|
|
|
2c1b57 |
@@ -776,9 +776,8 @@ static int load_devices(struct devs *devices, char *devmap,
|
|
|
2c1b57 |
*stp = st;
|
|
|
2c1b57 |
return -1;
|
|
|
2c1b57 |
}
|
|
|
2c1b57 |
- if (best[i] == -1
|
|
|
2c1b57 |
- || (devices[best[i]].i.events
|
|
|
2c1b57 |
- < devices[devcnt].i.events))
|
|
|
2c1b57 |
+ if (best[i] == -1 || (devices[best[i]].i.events
|
|
|
2c1b57 |
+ < devices[devcnt].i.events))
|
|
|
2c1b57 |
best[i] = devcnt;
|
|
|
2c1b57 |
}
|
|
|
2c1b57 |
devcnt++;
|
|
|
2c1b57 |
diff --git a/Grow.c b/Grow.c
|
|
|
2c1b57 |
index 39110b8..db3f18b 100644
|
|
|
2c1b57 |
--- a/Grow.c
|
|
|
2c1b57 |
+++ b/Grow.c
|
|
|
2c1b57 |
@@ -3995,8 +3995,8 @@ int progress_reshape(struct mdinfo *info, struct reshape *reshape,
|
|
|
2c1b57 |
* a backup.
|
|
|
2c1b57 |
*/
|
|
|
2c1b57 |
if (advancing) {
|
|
|
2c1b57 |
- if ((need_backup > info->reshape_progress
|
|
|
2c1b57 |
- || info->array.major_version < 0) &&
|
|
|
2c1b57 |
+ if ((need_backup > info->reshape_progress ||
|
|
|
2c1b57 |
+ info->array.major_version < 0) &&
|
|
|
2c1b57 |
*suspend_point < info->reshape_progress + target) {
|
|
|
2c1b57 |
if (need_backup < *suspend_point + 2 * target)
|
|
|
2c1b57 |
*suspend_point = need_backup;
|
|
|
2c1b57 |
@@ -4149,8 +4149,9 @@ check_progress:
|
|
|
2c1b57 |
* it was just a device failure that leaves us degraded but
|
|
|
2c1b57 |
* functioning.
|
|
|
2c1b57 |
*/
|
|
|
2c1b57 |
- if (sysfs_get_str(info, NULL, "reshape_position", buf, sizeof(buf)) < 0
|
|
|
2c1b57 |
- || strncmp(buf, "none", 4) != 0) {
|
|
|
2c1b57 |
+ if (sysfs_get_str(info, NULL, "reshape_position", buf,
|
|
|
2c1b57 |
+ sizeof(buf)) < 0 ||
|
|
|
2c1b57 |
+ strncmp(buf, "none", 4) != 0) {
|
|
|
2c1b57 |
/* The abort might only be temporary. Wait up to 10
|
|
|
2c1b57 |
* seconds for fd to contain a valid number again.
|
|
|
2c1b57 |
*/
|
|
|
2c1b57 |
@@ -4182,9 +4183,10 @@ check_progress:
|
|
|
2c1b57 |
/* Maybe racing with array shutdown - check state */
|
|
|
2c1b57 |
if (fd >= 0)
|
|
|
2c1b57 |
close(fd);
|
|
|
2c1b57 |
- if (sysfs_get_str(info, NULL, "array_state", buf, sizeof(buf)) < 0
|
|
|
2c1b57 |
- || strncmp(buf, "inactive", 8) == 0
|
|
|
2c1b57 |
- || strncmp(buf, "clear",5) == 0)
|
|
|
2c1b57 |
+ if (sysfs_get_str(info, NULL, "array_state", buf,
|
|
|
2c1b57 |
+ sizeof(buf)) < 0 ||
|
|
|
2c1b57 |
+ strncmp(buf, "inactive", 8) == 0 ||
|
|
|
2c1b57 |
+ strncmp(buf, "clear",5) == 0)
|
|
|
2c1b57 |
return -2; /* abort */
|
|
|
2c1b57 |
return -1; /* complete */
|
|
|
2c1b57 |
}
|
|
|
2c1b57 |
diff --git a/Manage.c b/Manage.c
|
|
|
2c1b57 |
index cee5dad..04b9398 100644
|
|
|
2c1b57 |
--- a/Manage.c
|
|
|
2c1b57 |
+++ b/Manage.c
|
|
|
2c1b57 |
@@ -655,8 +655,8 @@ int attempt_re_add(int fd, int tfd, struct mddev_dev *dv,
|
|
|
2c1b57 |
if (dv->failfast == FlagClear)
|
|
|
2c1b57 |
disc.state &= ~(1 << MD_DISK_FAILFAST);
|
|
|
2c1b57 |
remove_partitions(tfd);
|
|
|
2c1b57 |
- if (update || dv->writemostly != FlagDefault
|
|
|
2c1b57 |
- || dv->failfast != FlagDefault) {
|
|
|
2c1b57 |
+ if (update || dv->writemostly != FlagDefault ||
|
|
|
2c1b57 |
+ dv->failfast != FlagDefault) {
|
|
|
2c1b57 |
int rv = -1;
|
|
|
2c1b57 |
tfd = dev_open(dv->devname, O_RDWR);
|
|
|
2c1b57 |
if (tfd < 0) {
|
|
|
2c1b57 |
diff --git a/Monitor.c b/Monitor.c
|
|
|
2c1b57 |
index 0198a34..725f47d 100644
|
|
|
2c1b57 |
--- a/Monitor.c
|
|
|
2c1b57 |
+++ b/Monitor.c
|
|
|
2c1b57 |
@@ -530,7 +530,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
|
|
|
2c1b57 |
if (st->utime == array.utime && st->failed == sra->array.failed_disks &&
|
|
|
2c1b57 |
st->working == sra->array.working_disks &&
|
|
|
2c1b57 |
st->spare == sra->array.spare_disks &&
|
|
|
2c1b57 |
- (mse == NULL || (mse->percent == st->percent))) {
|
|
|
2c1b57 |
+ (mse == NULL || (mse->percent == st->percent))) {
|
|
|
2c1b57 |
if ((st->active < st->raid) && st->spare == 0)
|
|
|
2c1b57 |
retval = 1;
|
|
|
2c1b57 |
goto out;
|
|
|
2c1b57 |
@@ -672,7 +672,7 @@ static int add_new_arrays(struct mdstat_ent *mdstat, struct state **statelist,
|
|
|
2c1b57 |
char *name;
|
|
|
2c1b57 |
|
|
|
2c1b57 |
for (mse = mdstat; mse; mse = mse->next)
|
|
|
2c1b57 |
- if (mse->devnm[0] && (!mse->level || /* retrieve containers */
|
|
|
2c1b57 |
+ if (mse->devnm[0] && (!mse->level || /* retrieve containers */
|
|
|
2c1b57 |
(strcmp(mse->level, "raid0") != 0 &&
|
|
|
2c1b57 |
strcmp(mse->level, "linear") != 0))) {
|
|
|
2c1b57 |
struct state *st = xcalloc(1, sizeof *st);
|
|
|
2c1b57 |
diff --git a/mapfile.c b/mapfile.c
|
|
|
2c1b57 |
index c89d403..f3c8191 100644
|
|
|
2c1b57 |
--- a/mapfile.c
|
|
|
2c1b57 |
+++ b/mapfile.c
|
|
|
2c1b57 |
@@ -439,8 +439,8 @@ void RebuildMap(void)
|
|
|
2c1b57 |
if ((homehost == NULL ||
|
|
|
2c1b57 |
st->ss->match_home(st, homehost) != 1) &&
|
|
|
2c1b57 |
st->ss->match_home(st, "any") != 1 &&
|
|
|
2c1b57 |
- (require_homehost
|
|
|
2c1b57 |
- || ! conf_name_is_free(info->name)))
|
|
|
2c1b57 |
+ (require_homehost ||
|
|
|
2c1b57 |
+ !conf_name_is_free(info->name)))
|
|
|
2c1b57 |
/* require a numeric suffix */
|
|
|
2c1b57 |
unum = 0;
|
|
|
2c1b57 |
else
|
|
|
2c1b57 |
diff --git a/mdstat.c b/mdstat.c
|
|
|
2c1b57 |
index 3962896..0d44050 100644
|
|
|
2c1b57 |
--- a/mdstat.c
|
|
|
2c1b57 |
+++ b/mdstat.c
|
|
|
2c1b57 |
@@ -166,8 +166,8 @@ struct mdstat_ent *mdstat_read(int hold, int start)
|
|
|
2c1b57 |
continue;
|
|
|
2c1b57 |
insert_here = NULL;
|
|
|
2c1b57 |
/* Better be an md line.. */
|
|
|
2c1b57 |
- if (strncmp(line, "md", 2)!= 0 || strlen(line) >= 32
|
|
|
2c1b57 |
- || (line[2] != '_' && !isdigit(line[2])))
|
|
|
2c1b57 |
+ if (strncmp(line, "md", 2)!= 0 || strlen(line) >= 32 ||
|
|
|
2c1b57 |
+ (line[2] != '_' && !isdigit(line[2])))
|
|
|
2c1b57 |
continue;
|
|
|
2c1b57 |
strcpy(devnm, line);
|
|
|
2c1b57 |
|
|
|
2c1b57 |
@@ -212,8 +212,10 @@ struct mdstat_ent *mdstat_read(int hold, int start)
|
|
|
2c1b57 |
struct mdstat_ent **ih;
|
|
|
2c1b57 |
ih = &all;
|
|
|
2c1b57 |
while (ih != insert_here && *ih &&
|
|
|
2c1b57 |
- ((int)strlen((*ih)->devnm) != ep-w
|
|
|
2c1b57 |
- || strncmp((*ih)->devnm, w, ep-w) != 0))
|
|
|
2c1b57 |
+ ((int)strlen((*ih)->devnm) !=
|
|
|
2c1b57 |
+ ep-w ||
|
|
|
2c1b57 |
+ strncmp((*ih)->devnm, w,
|
|
|
2c1b57 |
+ ep-w) != 0))
|
|
|
2c1b57 |
ih = & (*ih)->next;
|
|
|
2c1b57 |
insert_here = ih;
|
|
|
2c1b57 |
}
|
|
|
2c1b57 |
diff --git a/platform-intel.c b/platform-intel.c
|
|
|
2c1b57 |
index 9867697..a11101d 100644
|
|
|
2c1b57 |
--- a/platform-intel.c
|
|
|
2c1b57 |
+++ b/platform-intel.c
|
|
|
2c1b57 |
@@ -548,8 +548,8 @@ static int read_efi_variable(void *buffer, ssize_t buf_size, char *variable_name
|
|
|
2c1b57 |
|
|
|
2c1b57 |
errno = 0;
|
|
|
2c1b57 |
var_data_len = strtoul(buf, NULL, 16);
|
|
|
2c1b57 |
- if ((errno == ERANGE && (var_data_len == LONG_MAX))
|
|
|
2c1b57 |
- || (errno != 0 && var_data_len == 0))
|
|
|
2c1b57 |
+ if ((errno == ERANGE && (var_data_len == LONG_MAX)) ||
|
|
|
2c1b57 |
+ (errno != 0 && var_data_len == 0))
|
|
|
2c1b57 |
return 1;
|
|
|
2c1b57 |
|
|
|
2c1b57 |
/* get data */
|
|
|
2c1b57 |
diff --git a/restripe.c b/restripe.c
|
|
|
2c1b57 |
index de85ee4..6b31695 100644
|
|
|
2c1b57 |
--- a/restripe.c
|
|
|
2c1b57 |
+++ b/restripe.c
|
|
|
2c1b57 |
@@ -731,8 +731,8 @@ int restore_stripes(int *dest, unsigned long long *offsets,
|
|
|
2c1b57 |
zero_size = chunk_size;
|
|
|
2c1b57 |
}
|
|
|
2c1b57 |
|
|
|
2c1b57 |
- if (stripe_buf == NULL || stripes == NULL || blocks == NULL
|
|
|
2c1b57 |
- || zero == NULL) {
|
|
|
2c1b57 |
+ if (stripe_buf == NULL || stripes == NULL || blocks == NULL ||
|
|
|
2c1b57 |
+ zero == NULL) {
|
|
|
2c1b57 |
rv = -2;
|
|
|
2c1b57 |
goto abort;
|
|
|
2c1b57 |
}
|
|
|
2c1b57 |
diff --git a/super-ddf.c b/super-ddf.c
|
|
|
2c1b57 |
index 769eded..4da7c09 100644
|
|
|
2c1b57 |
--- a/super-ddf.c
|
|
|
2c1b57 |
+++ b/super-ddf.c
|
|
|
2c1b57 |
@@ -932,14 +932,13 @@ static int load_ddf_headers(int fd, struct ddf_super *super, char *devname)
|
|
|
2c1b57 |
if (load_ddf_header(fd, be64_to_cpu(super->anchor.secondary_lba),
|
|
|
2c1b57 |
dsize >> 9, 2,
|
|
|
2c1b57 |
&super->secondary, &super->anchor)) {
|
|
|
2c1b57 |
- if (super->active == NULL
|
|
|
2c1b57 |
- || (be32_to_cpu(super->primary.seq)
|
|
|
2c1b57 |
- < be32_to_cpu(super->secondary.seq) &&
|
|
|
2c1b57 |
- !super->secondary.openflag)
|
|
|
2c1b57 |
- || (be32_to_cpu(super->primary.seq)
|
|
|
2c1b57 |
- == be32_to_cpu(super->secondary.seq) &&
|
|
|
2c1b57 |
- super->primary.openflag && !super->secondary.openflag)
|
|
|
2c1b57 |
- )
|
|
|
2c1b57 |
+ if (super->active == NULL ||
|
|
|
2c1b57 |
+ (be32_to_cpu(super->primary.seq)
|
|
|
2c1b57 |
+ < be32_to_cpu(super->secondary.seq) &&
|
|
|
2c1b57 |
+ !super->secondary.openflag) ||
|
|
|
2c1b57 |
+ (be32_to_cpu(super->primary.seq) ==
|
|
|
2c1b57 |
+ be32_to_cpu(super->secondary.seq) &&
|
|
|
2c1b57 |
+ super->primary.openflag && !super->secondary.openflag))
|
|
|
2c1b57 |
super->active = &super->secondary;
|
|
|
2c1b57 |
} else if (devname &&
|
|
|
2c1b57 |
be64_to_cpu(super->anchor.secondary_lba) != ~(__u64)0)
|
|
|
2c1b57 |
diff --git a/super-intel.c b/super-intel.c
|
|
|
2c1b57 |
index c84e755..3d0a37c 100644
|
|
|
2c1b57 |
--- a/super-intel.c
|
|
|
2c1b57 |
+++ b/super-intel.c
|
|
|
2c1b57 |
@@ -10874,8 +10874,7 @@ static int imsm_create_metadata_update_for_reshape(
|
|
|
2c1b57 |
*/
|
|
|
2c1b57 |
spares = get_spares_for_grow(st);
|
|
|
2c1b57 |
|
|
|
2c1b57 |
- if (spares == NULL
|
|
|
2c1b57 |
- || delta_disks > spares->array.spare_disks) {
|
|
|
2c1b57 |
+ if (spares == NULL || delta_disks > spares->array.spare_disks) {
|
|
|
2c1b57 |
pr_err("imsm: ERROR: Cannot get spare devices for %s.\n", geo->dev_name);
|
|
|
2c1b57 |
i = -1;
|
|
|
2c1b57 |
goto abort;
|
|
|
2c1b57 |
diff --git a/util.c b/util.c
|
|
|
2c1b57 |
index 0564c0b..d89438c 100644
|
|
|
2c1b57 |
--- a/util.c
|
|
|
2c1b57 |
+++ b/util.c
|
|
|
2c1b57 |
@@ -2213,8 +2213,7 @@ void enable_fds(int devices)
|
|
|
2c1b57 |
{
|
|
|
2c1b57 |
unsigned int fds = 20 + devices;
|
|
|
2c1b57 |
struct rlimit lim;
|
|
|
2c1b57 |
- if (getrlimit(RLIMIT_NOFILE, &lim) != 0
|
|
|
2c1b57 |
- || lim.rlim_cur >= fds)
|
|
|
2c1b57 |
+ if (getrlimit(RLIMIT_NOFILE, &lim) != 0 || lim.rlim_cur >= fds)
|
|
|
2c1b57 |
return;
|
|
|
2c1b57 |
if (lim.rlim_max < fds)
|
|
|
2c1b57 |
lim.rlim_max = fds;
|
|
|
2c1b57 |
--
|
|
|
2c1b57 |
2.7.4
|
|
|
2c1b57 |
|