Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs/ffs Fixes from enami:
details: https://anonhg.NetBSD.org/src/rev/56c997472613
branches: trunk
changeset: 524859:56c997472613
user: christos <christos%NetBSD.org@localhost>
date: Mon Apr 01 01:52:44 2002 +0000
description:
Fixes from enami:
- If VOP_ACCESS fails when updating mount, we will vrele() twice.
- The check for update-only flags in mp->mnt_flag when not updating
case is bogus. If we really want to check, we need to see flags in
ufs_args, but I'm not sure if it is really necessary.
- The credential passed to ffs_reload was credential of when looking
up mount point, but now it is credential of when looking up device
node. Anyway, it may be current process's credential.
diffstat:
sys/ufs/ffs/ffs_vfsops.c | 52 ++++++++++++++++-------------------------------
1 files changed, 18 insertions(+), 34 deletions(-)
diffs (108 lines):
diff -r 6933e0b3623b -r 56c997472613 sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c Sun Mar 31 23:34:00 2002 +0000
+++ b/sys/ufs/ffs/ffs_vfsops.c Mon Apr 01 01:52:44 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs_vfsops.c,v 1.95 2002/03/31 20:53:25 christos Exp $ */
+/* $NetBSD: ffs_vfsops.c,v 1.96 2002/04/01 01:52:44 christos Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1994
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.95 2002/03/31 20:53:25 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.96 2002/04/01 01:52:44 christos Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@@ -207,27 +207,9 @@
} else {
/* New mounts must have a filename for the device */
if (args.fspec == NULL)
- return EINVAL;
-
- /* Check for update-only flags */
- if (mp->mnt_flag &
- (MNT_WANTRDWR | /*
- * Upgrading from read-only to
- * read-write can only occur after
- * the initial mount
- */
- MNT_EXRDONLY |
- MNT_DEFEXPORTED |
- MNT_EXPORTANON |
- MNT_EXKERB | /* Only update mounts are allowed */
- MNT_EXNORESPORT | /* to affect exporting */
- MNT_EXPUBLIC |
- MNT_DELEXPORT))
- return EINVAL;
+ return (EINVAL);
}
- error = 0;
-
if (args.fspec) {
/*
* Look up the name and verify that it's sane.
@@ -252,13 +234,6 @@
*/
if (devvp != ump->um_devvp)
error = EINVAL;
- else
- /*
- * The initial mount got a reference on this
- * device, so drop the one obtained via
- * namei(), above
- */
- vrele(devvp);
}
}
@@ -268,8 +243,9 @@
*/
if (error == 0 && p->p_ucred->cr_uid != 0) {
accessmode = VREAD;
- if ((!update && (mp->mnt_flag & MNT_RDONLY) == 0) ||
- (update && (mp->mnt_flag & MNT_WANTRDWR)))
+ if (update ?
+ (mp->mnt_flag & MNT_WANTRDWR) != 0 :
+ (mp->mnt_flag & MNT_RDONLY) == 0)
accessmode |= VWRITE;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
error = VOP_ACCESS(devvp, accessmode, p->p_ucred, p);
@@ -293,14 +269,22 @@
if ((mp->mnt_flag & (MNT_SOFTDEP | MNT_ASYNC)) ==
(MNT_SOFTDEP | MNT_ASYNC)) {
printf("%s fs uses soft updates, "
- "ignoring async mode\n",
- fs->fs_fsmnt);
+ "ignoring async mode\n",
+ fs->fs_fsmnt);
mp->mnt_flag &= ~MNT_ASYNC;
}
} else {
/*
- * Update the mount
+ * Update the mount.
*/
+
+ /*
+ * The initial mount got a reference on this
+ * device, so drop the one obtained via
+ * namei(), above.
+ */
+ vrele(devvp);
+
fs = ump->um_fs;
if (fs->fs_ronly == 0 && (mp->mnt_flag & MNT_RDONLY)) {
/*
@@ -372,7 +356,7 @@
}
if (mp->mnt_flag & MNT_RELOAD) {
- error = ffs_reload(mp, ndp->ni_cnd.cn_cred, p);
+ error = ffs_reload(mp, p->p_ucred, p);
if (error)
return (error);
}
Home |
Main Index |
Thread Index |
Old Index