diff options
author | pjd <pjd@FreeBSD.org> | 2004-06-27 12:56:11 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2004-06-27 12:56:11 +0000 |
commit | 8395a82f93dfbb89b907d5d2437f248f1f0c3503 (patch) | |
tree | 43dc7bd5110aae846737543e0be961c6eff1ece2 | |
parent | f9dd4765eb8f07a12b30bb744bfeaeb4ceca8663 (diff) | |
download | FreeBSD-src-8395a82f93dfbb89b907d5d2437f248f1f0c3503.zip FreeBSD-src-8395a82f93dfbb89b907d5d2437f248f1f0c3503.tar.gz |
Introduce a hack that will make geom_gate to work with read-only mounts.
Now, when trying to mount file system in read-only mode it tries to
opened a device for writting to be able to update to read-write mode
latter. Ehh.
Discussed with: phk
-rw-r--r-- | sys/geom/gate/g_gate.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/geom/gate/g_gate.c b/sys/geom/gate/g_gate.c index 360238b..fb7e81a 100644 --- a/sys/geom/gate/g_gate.c +++ b/sys/geom/gate/g_gate.c @@ -174,8 +174,11 @@ g_gate_access(struct g_provider *pp, int dr, int dw, int de) sc = pp->geom->softc; if (sc == NULL || (sc->sc_flags & G_GATE_FLAG_DESTROY) != 0) return (ENXIO); + /* XXX: Hack to allow read-only mounts. */ +#if 0 if ((sc->sc_flags & G_GATE_FLAG_READONLY) != 0 && dw > 0) return (EPERM); +#endif if ((sc->sc_flags & G_GATE_FLAG_WRITEONLY) != 0 && dr > 0) return (EPERM); return (0); @@ -195,8 +198,14 @@ g_gate_start(struct bio *bp) G_GATE_LOGREQ(2, bp, "Request received."); switch (bp->bio_cmd) { case BIO_READ: + break; case BIO_DELETE: case BIO_WRITE: + /* XXX: Hack to allow read-only mounts. */ + if ((sc->sc_flags & G_GATE_FLAG_READONLY) != 0) { + g_io_deliver(bp, EPERM); + return; + } break; case BIO_GETATTR: default: |