diff --git a/sys/fs/sysvbfs/sysvbfs_vfsops.c b/sys/fs/sysvbfs/sysvbfs_vfsops.c index defd9bd7be03..e4e89fe252e4 100644 --- a/sys/fs/sysvbfs/sysvbfs_vfsops.c +++ b/sys/fs/sysvbfs/sysvbfs_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: sysvbfs_vfsops.c,v 1.25 2008/09/04 12:02:10 pooka Exp $ */ +/* $NetBSD: sysvbfs_vfsops.c,v 1.26 2008/09/04 12:28:14 pooka Exp $ */ /*- * Copyright (c) 2004 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vfsops.c,v 1.25 2008/09/04 12:02:10 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vfsops.c,v 1.26 2008/09/04 12:28:14 pooka Exp $"); #include #include @@ -163,7 +163,7 @@ sysvbfs_mountfs(struct vnode *devvp, struct mount *mp, struct lwp *l) kauth_cred_t cred = l->l_cred; struct sysvbfs_mount *bmp; struct partinfo dpart; - int error; + int error, oflags; vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY); error = vinvalbuf(devvp, V_SAVE, cred, l, 0, 0); @@ -172,7 +172,10 @@ sysvbfs_mountfs(struct vnode *devvp, struct mount *mp, struct lwp *l) return error; /* Open block device */ - if ((error = VOP_OPEN(devvp, FREAD | FWRITE, NOCRED)) != 0) + oflags = FREAD; + if ((mp->mnt_flag & MNT_RDONLY) == 0) + oflags |= FWRITE; + if ((error = VOP_OPEN(devvp, oflags, NOCRED)) != 0) return error; /* Get partition information */