Clean up the usage of vn_start_write(). At least one occurence clobbered

previous error conditions.
If "(flags & (V_WAIT|V_PCATCH)) == V_WAIT" the return value is always zero.
Ignore the return value in these cases.

From Darrin B. Jewell.
This commit is contained in:
hannken 2003-11-05 10:18:38 +00:00
parent ca8c391c95
commit 2ef662a69e
5 changed files with 19 additions and 32 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_serv.c,v 1.85 2003/10/29 21:28:37 mycroft Exp $ */
/* $NetBSD: nfs_serv.c,v 1.86 2003/11/05 10:18:38 hannken Exp $ */
/*
* Copyright (c) 1989, 1993
@ -55,7 +55,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.85 2003/10/29 21:28:37 mycroft Exp $");
__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.86 2003/11/05 10:18:38 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1255,7 +1255,7 @@ loop1:
if (!error) {
if (vn_start_write(vp, &mntp, V_NOWAIT) != 0) {
VOP_UNLOCK(vp, 0);
error = vn_start_write(NULL, &mntp, V_WAIT);
vn_start_write(NULL, &mntp, V_WAIT);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
}
if (!error) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: ext2fs_inode.c,v 1.37 2003/10/15 11:29:01 hannken Exp $ */
/* $NetBSD: ext2fs_inode.c,v 1.38 2003/11/05 10:18:38 hannken Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ext2fs_inode.c,v 1.37 2003/10/15 11:29:01 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: ext2fs_inode.c,v 1.38 2003/11/05 10:18:38 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -118,9 +118,7 @@ ext2fs_inactive(v)
error = 0;
if (ip->i_e2fs_nlink == 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) == 0) {
error = vn_start_write(vp, &mp, V_WAIT | V_LOWER);
if (error)
return (error);
vn_start_write(vp, &mp, V_WAIT | V_LOWER);
if (ip->i_e2fs_size != 0) {
error = VOP_TRUNCATE(vp, (off_t)0, 0, NOCRED, NULL);
}
@ -132,9 +130,7 @@ ext2fs_inactive(v)
}
if (ip->i_flag &
(IN_ACCESS | IN_CHANGE | IN_UPDATE | IN_MODIFIED | IN_ACCESSED)) {
error = vn_start_write(vp, &mp, V_WAIT | V_LOWER);
if (error)
return (error);
vn_start_write(vp, &mp, V_WAIT | V_LOWER);
VOP_UPDATE(vp, NULL, NULL, 0);
vn_finished_write(mp, V_LOWER);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs_vfsops.c,v 1.126 2003/10/30 01:43:10 simonb Exp $ */
/* $NetBSD: ffs_vfsops.c,v 1.127 2003/11/05 10:18:38 hannken Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1994
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.126 2003/10/30 01:43:10 simonb Exp $");
__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.127 2003/11/05 10:18:38 hannken Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@ -302,8 +302,7 @@ ffs_mount(mp, path, data, ndp, p)
/*
* Changing from r/w to r/o
*/
if ((error = vn_start_write(NULL, &mp, V_WAIT)) != 0)
return (error);
vn_start_write(NULL, &mp, V_WAIT);
flags = WRITECLOSE;
if (mp->mnt_flag & MNT_FORCE)
flags |= FORCECLOSE;
@ -343,8 +342,7 @@ ffs_mount(mp, path, data, ndp, p)
if ((fs->fs_flags & FS_DOSOFTDEP) &&
!(mp->mnt_flag & MNT_SOFTDEP) && fs->fs_ronly == 0) {
#ifdef notyet
if ((error = vn_start_write(NULL, &mp, V_WAIT)) != 0)
return (error);
vn_start_write(NULL, &mp, V_WAIT);
flags = WRITECLOSE;
if (mp->mnt_flag & MNT_FORCE)
flags |= FORCECLOSE;
@ -365,8 +363,7 @@ ffs_mount(mp, path, data, ndp, p)
if (!(fs->fs_flags & FS_DOSOFTDEP) &&
(mp->mnt_flag & MNT_SOFTDEP) && fs->fs_ronly == 0) {
#ifdef notyet
if ((error = vn_start_write(NULL, &mp, V_WAIT)) != 0)
return (error);
vn_start_write(NULL, &mp, V_WAIT);
flags = WRITECLOSE;
if (mp->mnt_flag & MNT_FORCE)
flags |= FORCECLOSE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_inode.c,v 1.41 2003/10/15 11:29:01 hannken Exp $ */
/* $NetBSD: ufs_inode.c,v 1.42 2003/11/05 10:18:38 hannken Exp $ */
/*
* Copyright (c) 1991, 1993
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ufs_inode.c,v 1.41 2003/10/15 11:29:01 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: ufs_inode.c,v 1.42 2003/11/05 10:18:38 hannken Exp $");
#include "opt_quota.h"
@ -88,9 +88,7 @@ ufs_inactive(v)
softdep_releasefile(ip);
if (ip->i_nlink <= 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) == 0) {
error = vn_start_write(vp, &mp, V_WAIT | V_LOWER);
if (error)
return (error);
vn_start_write(vp, &mp, V_WAIT | V_LOWER);
#ifdef QUOTA
if (!getinoquota(ip))
(void)chkiq(ip, -1, NOCRED, 0);
@ -117,9 +115,7 @@ ufs_inactive(v)
if (ip->i_flag &
(IN_ACCESS | IN_CHANGE | IN_UPDATE | IN_MODIFIED | IN_ACCESSED)) {
error = vn_start_write(vp, &mp, V_WAIT | V_LOWER);
if (error)
return (error);
vn_start_write(vp, &mp, V_WAIT | V_LOWER);
VOP_UPDATE(vp, NULL, NULL, 0);
vn_finished_write(mp, V_LOWER);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_quota.c,v 1.29 2003/10/15 11:29:01 hannken Exp $ */
/* $NetBSD: ufs_quota.c,v 1.30 2003/11/05 10:18:38 hannken Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993, 1995
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.29 2003/10/15 11:29:01 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.30 2003/11/05 10:18:38 hannken Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -898,9 +898,7 @@ dqsync(vp, dq)
return (0);
if ((dqvp = dq->dq_ump->um_quotas[dq->dq_type]) == NULLVP)
panic("dqsync: file");
error = vn_start_write(dqvp, &mp, V_WAIT | V_LOWER);
if (error)
return (error);
vn_start_write(dqvp, &mp, V_WAIT | V_LOWER);
if (vp != dqvp)
vn_lock(dqvp, LK_EXCLUSIVE | LK_RETRY);
while (dq->dq_flags & DQ_LOCK) {