aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/md
diff options
context:
space:
mode:
authorStephen J. Kiernan <stevek@FreeBSD.org>2017-05-31 21:18:11 +0000
committerStephen J. Kiernan <stevek@FreeBSD.org>2017-05-31 21:18:11 +0000
commit9a81ba0f241a477b92f3ae3b48429a04724459f2 (patch)
treee4600b82a37dff45691a2d569c138a8e88294049 /sys/dev/md
parent9a83b0971e6fc935a65feee3b0e2407a89ccc4bd (diff)
Notes
Diffstat (limited to 'sys/dev/md')
-rw-r--r--sys/dev/md/md.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c
index ae33c1e208e8..dd0b31c63bdc 100644
--- a/sys/dev/md/md.c
+++ b/sys/dev/md/md.c
@@ -88,6 +88,7 @@
#include <sys/sf_buf.h>
#include <sys/sysctl.h>
#include <sys/vnode.h>
+#include <sys/disk.h>
#include <geom/geom.h>
#include <geom/geom_int.h>
@@ -949,6 +950,8 @@ unmapped_step:
sc->cred);
VOP_UNLOCK(vp, 0);
vn_finished_write(mp);
+ if (error == 0)
+ sc->flags &= ~MD_VERIFY;
}
if (pb != NULL) {
@@ -1143,6 +1146,8 @@ md_kthread(void *arg)
}
mtx_unlock(&sc->queue_mtx);
if (bp->bio_cmd == BIO_GETATTR) {
+ int isv = ((sc->flags & MD_VERIFY) != 0);
+
if ((sc->fwsectors && sc->fwheads &&
(g_handleattr_int(bp, "GEOM::fwsectors",
sc->fwsectors) ||
@@ -1150,6 +1155,8 @@ md_kthread(void *arg)
sc->fwheads))) ||
g_handleattr_int(bp, "GEOM::candelete", 1))
error = -1;
+ else if (g_handleattr_int(bp, "MNT::verified", isv))
+ error = -1;
else
error = EOPNOTSUPP;
} else {
@@ -1352,7 +1359,8 @@ mdcreate_vnode(struct md_s *sc, struct md_ioctl *mdio, struct thread *td)
* If the user specified that this is a read only device, don't
* set the FWRITE mask before trying to open the backing store.
*/
- flags = FREAD | ((mdio->md_options & MD_READONLY) ? 0 : FWRITE);
+ flags = FREAD | ((mdio->md_options & MD_READONLY) ? 0 : FWRITE) \
+ | ((mdio->md_options & MD_VERIFY) ? 0 : O_VERIFY);
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, sc->file, td);
error = vn_open(&nd, &flags, 0, NULL);
if (error != 0)
@@ -1380,7 +1388,7 @@ mdcreate_vnode(struct md_s *sc, struct md_ioctl *mdio, struct thread *td)
sc->fwsectors = mdio->md_fwsectors;
if (mdio->md_fwheads != 0)
sc->fwheads = mdio->md_fwheads;
- sc->flags = mdio->md_options & (MD_FORCE | MD_ASYNC);
+ sc->flags = mdio->md_options & (MD_FORCE | MD_ASYNC | MD_VERIFY);
if (!(flags & FWRITE))
sc->flags |= MD_READONLY;
sc->vnode = nd.ni_vp;
@@ -1523,6 +1531,8 @@ mdcreate_swap(struct md_s *sc, struct md_ioctl *mdio, struct thread *td)
* Note the truncation.
*/
+ if ((mdio->md_options & MD_VERIFY) != 0)
+ return (EINVAL);
npage = mdio->md_mediasize / PAGE_SIZE;
if (mdio->md_fwsectors != 0)
sc->fwsectors = mdio->md_fwsectors;