From 730441b710704e62e7888e014283f788e091236f Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Sun, 10 Jun 2012 21:29:05 +0000 Subject: Do NOT make all check condition results report EIO. Only use EIO when b_error has not already been set to something more informative, e.g. EROFS. DO check the result of ffs_sbupdate() and error out of a mount() call when ffs_sbupdate() reports EROFS while attempting a rw mount. Letting RW mounts proceed regardless of EROFS led to crashes and usb problems for Oliver Seufer while using the RW/RO switches on some usb devices. Fix developed using devices kindly supplied by Oliver & Co. ok miod@ --- sys/ufs/ffs/ffs_vfsops.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sys/ufs') diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 0b9fec7fd2e..619880c2803 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_vfsops.c,v 1.133 2011/07/04 20:35:35 deraadt Exp $ */ +/* $OpenBSD: ffs_vfsops.c,v 1.134 2012/06/10 21:29:04 krw Exp $ */ /* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */ /* @@ -902,7 +902,9 @@ ffs_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p) fs->fs_flags |= FS_DOSOFTDEP; else fs->fs_flags &= ~FS_DOSOFTDEP; - (void) ffs_sbupdate(ump, MNT_WAIT); + error = ffs_sbupdate(ump, MNT_WAIT); + if (error == EROFS) + goto out; } return (0); out: -- cgit v1.2.3