summaryrefslogtreecommitdiffstats
path: root/sys/geom/virstor
diff options
context:
space:
mode:
authorivoras <ivoras@FreeBSD.org>2010-01-25 20:51:40 +0000
committerivoras <ivoras@FreeBSD.org>2010-01-25 20:51:40 +0000
commitbbd4c1e2b3a7f7b8448074667774222cdf2d8e86 (patch)
treec03632e225a01c0db19cd43e506d66ec79111379 /sys/geom/virstor
parent03ff497455ffa7fe810e1fb42d95a0e867cb4294 (diff)
downloadFreeBSD-src-bbd4c1e2b3a7f7b8448074667774222cdf2d8e86.zip
FreeBSD-src-bbd4c1e2b3a7f7b8448074667774222cdf2d8e86.tar.gz
Go through with write_metadata() non-error-handling and make it return "void".
This is mostly to avoid dead variable assignment warning by LLVM. No functional change. Pointed out by: trasz Approved by: gnn (mentor)
Diffstat (limited to 'sys/geom/virstor')
-rw-r--r--sys/geom/virstor/g_virstor.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/sys/geom/virstor/g_virstor.c b/sys/geom/virstor/g_virstor.c
index 1de3d5a..cd84b05 100644
--- a/sys/geom/virstor/g_virstor.c
+++ b/sys/geom/virstor/g_virstor.c
@@ -98,7 +98,7 @@ SYSCTL_UINT(_kern_geom_virstor, OID_AUTO, component_watermark, CTLFLAG_RW,
"Minimum number of free components before issuing administrative warning");
static int read_metadata(struct g_consumer *, struct g_virstor_metadata *);
-static int write_metadata(struct g_consumer *, struct g_virstor_metadata *);
+static void write_metadata(struct g_consumer *, struct g_virstor_metadata *);
static int clear_metadata(struct g_virstor_component *);
static int add_provider_to_geom(struct g_virstor_softc *, struct g_provider *,
struct g_virstor_metadata *);
@@ -1002,8 +1002,13 @@ read_metadata(struct g_consumer *cp, struct g_virstor_metadata *md)
/**
* Utility function: encode & write metadata. Assumes topology lock is
* held.
+ *
+ * There is no useful way of recovering from errors in this function,
+ * not involving panicking the kernel. If the metadata cannot be written
+ * the most we can do is notify the operator and hope he spots it and
+ * replaces the broken drive.
*/
-static int
+static void
write_metadata(struct g_consumer *cp, struct g_virstor_metadata *md)
{
struct g_provider *pp;
@@ -1015,8 +1020,11 @@ write_metadata(struct g_consumer *cp, struct g_virstor_metadata *md)
LOG_MSG(LVL_DEBUG, "Writing metadata on %s", cp->provider->name);
g_topology_assert();
error = g_access(cp, 0, 1, 0);
- if (error != 0)
- return (error);
+ if (error != 0) {
+ LOG_MSG(LVL_ERROR, "g_access(0,1,0) failed for %s: %d",
+ cp->provider->name, error);
+ return;
+ }
pp = cp->provider;
buf = malloc(pp->sectorsize, M_GVIRSTOR, M_WAITOK);
@@ -1026,9 +1034,11 @@ write_metadata(struct g_consumer *cp, struct g_virstor_metadata *md)
pp->sectorsize);
g_topology_lock();
g_access(cp, 0, -1, 0);
-
free(buf, M_GVIRSTOR);
- return (0);
+
+ if (error != 0)
+ LOG_MSG(LVL_ERROR, "Error %d writing metadata to %s",
+ error, cp->provider->name);
}
/*
OpenPOWER on IntegriCloud