From: Jes.Sorensen@redhat.com
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org, dledford@redhat.com
Subject: [PATCH 1/1] Incremental() lock error handling
Date: Fri, 21 Oct 2011 18:21:38 +0200 [thread overview]
Message-ID: <1319214098-10409-2-git-send-email-Jes.Sorensen@redhat.com> (raw)
In-Reply-To: <1319214098-10409-1-git-send-email-Jes.Sorensen@redhat.com>
From: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
Incremental.c | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/Incremental.c b/Incremental.c
index 5c5f34f..0241aa1 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -298,7 +298,7 @@ int Incremental(char *devname, int verbose, int runstop,
name_to_use, autof, trustworthy, chosen_name);
if (mdfd < 0)
- goto out;
+ goto out_unlock;
sysfs_init(&info, mdfd, 0);
@@ -306,7 +306,7 @@ int Incremental(char *devname, int verbose, int runstop,
fprintf(stderr, Name ": failed to set array info for %s: %s\n",
chosen_name, strerror(errno));
rv = 2;
- goto out;
+ goto out_unlock;
}
dinfo = info;
@@ -317,7 +317,7 @@ int Incremental(char *devname, int verbose, int runstop,
devname, chosen_name, strerror(errno));
ioctl(mdfd, STOP_ARRAY, 0);
rv = 2;
- goto out;
+ goto out_unlock;
}
sra = sysfs_read(mdfd, -1, (GET_DEVS | GET_STATE |
GET_OFFSET | GET_SIZE));
@@ -333,7 +333,7 @@ int Incremental(char *devname, int verbose, int runstop,
" --incremental reliably. Aborting.\n");
sysfs_free(sra);
rv = 2;
- goto out;
+ goto out_unlock;
}
info.array.working_disks = 1;
/* 6/ Make sure /var/run/mdadm.map contains this array. */
@@ -380,12 +380,12 @@ int Incremental(char *devname, int verbose, int runstop,
": not adding %s to active array (without --run) %s\n",
devname, chosen_name);
rv = 2;
- goto out;
+ goto out_unlock;
}
}
if (!sra) {
rv = 2;
- goto out;
+ goto out_unlock;
}
if (sra->devs) {
sprintf(dn, "%d:%d", sra->devs->disk.major,
@@ -400,7 +400,7 @@ int Incremental(char *devname, int verbose, int runstop,
devname, chosen_name);
close(dfd2);
rv = 2;
- goto out;
+ goto out_unlock;
}
close(dfd2);
st2->ss->getinfo_super(st2, &info2, NULL);
@@ -412,7 +412,7 @@ int Incremental(char *devname, int verbose, int runstop,
": unexpected difference between %s and %s.\n",
chosen_name, devname);
rv = 2;
- goto out;
+ goto out_unlock;
}
}
info2.disk.major = major(stb.st_rdev);
@@ -433,7 +433,7 @@ int Incremental(char *devname, int verbose, int runstop,
fprintf(stderr, Name ": failed to add %s to %s: %s.\n",
devname, chosen_name, strerror(errno));
rv = 2;
- goto out;
+ goto out_unlock;
}
info.array.working_disks = 0;
for (d = sra->devs; d; d=d->next)
@@ -486,9 +486,8 @@ int Incremental(char *devname, int verbose, int runstop,
fprintf(stderr, Name
": %s attached to %s, not enough to start (%d).\n",
devname, chosen_name, active_disks);
- map_unlock(&map);
rv = 0;
- goto out;
+ goto out_unlock;
}
/* 7b/ if yes, */
@@ -502,9 +501,8 @@ int Incremental(char *devname, int verbose, int runstop,
fprintf(stderr, Name
": %s attached to %s which is already active.\n",
devname, chosen_name);
- map_unlock(&map);
rv = 0;
- goto out;
+ goto out_unlock;
}
map_unlock(&map);
@@ -585,6 +583,9 @@ out:
if (sra)
sysfs_free(sra);
return rv;
+out_unlock:
+ map_unlock(&map);
+ goto out;
}
static struct mddev_ident *search_mdstat(struct supertype *st,
--
1.7.4.4
prev parent reply other threads:[~2011-10-21 16:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-21 16:21 [PATCH 0/1] Incremental() additional locking fixes Jes.Sorensen
2011-10-21 16:21 ` Jes.Sorensen [this message]
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=1319214098-10409-2-git-send-email-Jes.Sorensen@redhat.com \
--to=jes.sorensen@redhat.com \
--cc=dledford@redhat.com \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.de \
/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).