summaryrefslogtreecommitdiffstats
path: root/sys/fs
diff options
context:
space:
mode:
authorkato <kato@FreeBSD.org>1997-09-27 13:40:20 +0000
committerkato <kato@FreeBSD.org>1997-09-27 13:40:20 +0000
commitfe9b86cf0b7a453c772a2756389fda91c12c3fab (patch)
treee695260038ca9665181b5b5c99ae6fa77fba443a /sys/fs
parent31e1d6ad00b9d8f39549115d4ef76fbee62e9748 (diff)
downloadFreeBSD-src-fe9b86cf0b7a453c772a2756389fda91c12c3fab.zip
FreeBSD-src-fe9b86cf0b7a453c772a2756389fda91c12c3fab.tar.gz
Clustered read and write are switched at mount-option level.
1. Clustered I/O is switched by the MNT_NOCLUSTERR and MNT_NOCLUSTERW bits of the mnt_flag. The sysctl variables, vfs.foo.doclusterread and vfs.foo.doclusterwrite are deleted. Only mount option can control clustered I/O from userland. 2. When foofs_mount mounts block device, foofs_mount checks D_CLUSTERR and D_CLUSTERW bits of the d_flags member in the block device switch table. If D_NOCLUSTERR / D_NOCLUSTERW are set, MNT_NOCLUSTERR / MNT_NOCLUSTERW bits will be set. In this case, MNT_NOCLUSTERR and MNT_NOCLUSTERW cannot be cleared from userland. 3. Vnode driver disables both clustered read and write. 4. Union filesystem disables clutered write. Reviewed by: bde
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/cd9660/cd9660_vfsops.c18
-rw-r--r--sys/fs/cd9660/cd9660_vnops.c20
-rw-r--r--sys/fs/specfs/spec_vnops.c11
-rw-r--r--sys/fs/unionfs/union_vfsops.c7
4 files changed, 28 insertions, 28 deletions
diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c
index c652ab1..b29a042 100644
--- a/sys/fs/cd9660/cd9660_vfsops.c
+++ b/sys/fs/cd9660/cd9660_vfsops.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95
- * $Id: cd9660_vfsops.c,v 1.27 1997/08/16 19:15:00 wollman Exp $
+ * $Id: cd9660_vfsops.c,v 1.28 1997/09/07 16:20:42 bde Exp $
*/
#include <sys/param.h>
@@ -183,9 +183,11 @@ cd9660_mount(mp, path, data, ndp, p)
int error;
struct iso_mnt *imp = 0;
- if ((mp->mnt_flag & MNT_ROOTFS) != 0)
+ if ((mp->mnt_flag & MNT_ROOTFS) != 0) {
+ if (bdevsw[major(rootdev)]->d_flags & D_NOCLUSTERR)
+ mp->mnt_flag |= MNT_NOCLUSTERR;
return (iso_mountroot(mp, p));
-
+ }
if ((error = copyin(data, (caddr_t)&args, sizeof (struct iso_args))))
return (error);
@@ -195,9 +197,13 @@ cd9660_mount(mp, path, data, ndp, p)
/*
* If updating, check whether changing from read-only to
* read/write; if there is no device name, that's all we do.
+ * Disallow clearing MNT_NOCLUSTERR flag, if block device requests.
*/
if (mp->mnt_flag & MNT_UPDATE) {
imp = VFSTOISOFS(mp);
+ if (bdevsw[major(imp->im_devvp->v_rdev)]->d_flags &
+ D_NOCLUSTERR)
+ mp->mnt_flag |= MNT_NOCLUSTERR;
if (args.fspec == 0)
return (vfs_export(mp, &imp->im_export, &args.export));
}
@@ -218,9 +224,11 @@ cd9660_mount(mp, path, data, ndp, p)
vrele(devvp);
return ENXIO;
}
- if ((mp->mnt_flag & MNT_UPDATE) == 0)
+ if ((mp->mnt_flag & MNT_UPDATE) == 0) {
+ if (bdevsw[major(devvp->v_rdev)]->d_flags & D_NOCLUSTERR)
+ mp->mnt_flag |= MNT_NOCLUSTERR;
error = iso_mountfs(devvp, mp, p, &args);
- else {
+ } else {
if (devvp != imp->im_devvp)
error = EINVAL; /* needs translation */
else
diff --git a/sys/fs/cd9660/cd9660_vnops.c b/sys/fs/cd9660/cd9660_vnops.c
index e518e89..cddb6fd 100644
--- a/sys/fs/cd9660/cd9660_vnops.c
+++ b/sys/fs/cd9660/cd9660_vnops.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vnops.c 8.19 (Berkeley) 5/27/95
- * $Id: cd9660_vnops.c,v 1.38 1997/09/14 02:57:43 peter Exp $
+ * $Id: cd9660_vnops.c,v 1.39 1997/09/21 04:22:40 dyson Exp $
*/
#include <sys/param.h>
@@ -81,17 +81,6 @@ static int cd9660_print __P((struct vop_print_args *));
static int cd9660_islocked __P((struct vop_islocked_args *));
/*
- * Sysctl values for the cd9660 filesystem.
- */
-#define CD9660_CLUSTERREAD 1 /* cluster reading enabled */
-#define CD9660_MAXID 2 /* number of valid cd9660 ids */
-
-#define CD9660_NAMES { \
- {0, 0}, \
- { "doclusterread", CTLTYPE_INT}, \
-}
-
-/*
* Setattr call. Only allowed for block and character special devices.
*/
int
@@ -299,11 +288,6 @@ cd9660_getattr(ap)
return (0);
}
-static int cd9660_doclusterread = 1;
-SYSCTL_NODE(_vfs, MOUNT_CD9660, cd9660, CTLFLAG_RW, 0, "CD9660 filesystem");
-SYSCTL_INT(_vfs_cd9660, CD9660_CLUSTERREAD, doclusterread,
- CTLFLAG_RW, &cd9660_doclusterread, 0, "");
-
/*
* Vnode op for reading.
*/
@@ -344,7 +328,7 @@ cd9660_read(ap)
n = diff;
size = blksize(imp, ip, lbn);
rablock = lbn + 1;
- if (cd9660_doclusterread) {
+ if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
if (lblktosize(imp, rablock) <= ip->i_size)
error = cluster_read(vp, (off_t)ip->i_size,
lbn, size, NOCRED, uio->uio_resid,
diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c
index b5407ee..dd05fc0 100644
--- a/sys/fs/specfs/spec_vnops.c
+++ b/sys/fs/specfs/spec_vnops.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95
- * $Id: spec_vnops.c,v 1.41 1997/09/02 20:06:12 bde Exp $
+ * $Id: spec_vnops.c,v 1.42 1997/09/14 02:58:02 peter Exp $
*/
#include <sys/param.h>
@@ -176,7 +176,8 @@ spec_open(ap)
*/
if (securelevel >= 2
&& cdevsw[maj]->d_bdev
- && cdevsw[maj]->d_bdev->d_flags == D_DISK)
+ && (cdevsw[maj]->d_bdev->d_flags & D_TYPEMASK) ==
+ D_DISK)
return (EPERM);
/*
* When running in secure mode, do not allow opens
@@ -220,7 +221,8 @@ spec_open(ap)
* opens for writing of any disk block devices.
*/
if (securelevel >= 2 && ap->a_cred != FSCRED &&
- (ap->a_mode & FWRITE) && bdevsw[maj]->d_flags == D_DISK)
+ (ap->a_mode & FWRITE) &&
+ (bdevsw[maj]->d_flags & D_TYPEMASK) == D_DISK)
return (EPERM);
/*
* Do not allow opens of block devices that are
@@ -422,7 +424,8 @@ spec_ioctl(ap)
case VBLK:
if (ap->a_command == 0 && (int)ap->a_data == B_TAPE)
- if (bdevsw[major(dev)]->d_flags == D_TAPE)
+ if ((bdevsw[major(dev)]->d_flags & D_TYPEMASK) ==
+ D_TAPE)
return (0);
else
return (1);
diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c
index e7954be..8478a1c 100644
--- a/sys/fs/unionfs/union_vfsops.c
+++ b/sys/fs/unionfs/union_vfsops.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* @(#)union_vfsops.c 8.20 (Berkeley) 5/20/95
- * $Id: union_vfsops.c,v 1.18 1997/08/02 14:32:29 bde Exp $
+ * $Id: union_vfsops.c,v 1.19 1997/08/16 19:15:22 wollman Exp $
*/
/*
@@ -103,6 +103,11 @@ union_mount(mp, path, data, ndp, p)
#endif
/*
+ * Disable clustered write, otherwise system becomes unstable.
+ */
+ mp->mnt_flag |= MNT_NOCLUSTERW;
+
+ /*
* Update is a no-op
*/
if (mp->mnt_flag & MNT_UPDATE) {
OpenPOWER on IntegriCloud