mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-03 08:22:44 +00:00
"bogus" fixes from 1.1.5 to work around some cache coherency problems.
This commit is contained in:
parent
e348d9c3a8
commit
1cdeb653a8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=2384
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vfs_subr.c 8.13 (Berkeley) 4/18/94
|
||||
* $Id: vfs_subr.c,v 1.6 1994/08/22 17:05:00 davidg Exp $
|
||||
* $Id: vfs_subr.c,v 1.7 1994/08/24 04:06:39 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -437,6 +437,8 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo)
|
||||
register struct buf *bp;
|
||||
struct buf *nbp, *blist;
|
||||
int s, error;
|
||||
vm_pager_t pager;
|
||||
vm_object_t object;
|
||||
|
||||
if (flags & V_SAVE) {
|
||||
if (error = VOP_FSYNC(vp, cred, MNT_WAIT, p))
|
||||
@ -445,7 +447,7 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo)
|
||||
panic("vinvalbuf: dirty bufs");
|
||||
}
|
||||
for (;;) {
|
||||
if ((blist = vp->v_cleanblkhd.lh_first) && flags & V_SAVEMETA)
|
||||
if ((blist = vp->v_cleanblkhd.lh_first) && (flags & V_SAVEMETA))
|
||||
while (blist && blist->b_lblkno < 0)
|
||||
blist = blist->b_vnbufs.le_next;
|
||||
if (!blist && (blist = vp->v_dirtyblkhd.lh_first) &&
|
||||
@ -457,7 +459,7 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo)
|
||||
|
||||
for (bp = blist; bp; bp = nbp) {
|
||||
nbp = bp->b_vnbufs.le_next;
|
||||
if (flags & V_SAVEMETA && bp->b_lblkno < 0)
|
||||
if ((flags & V_SAVEMETA) && bp->b_lblkno < 0)
|
||||
continue;
|
||||
s = splbio();
|
||||
if (bp->b_flags & B_BUSY) {
|
||||
@ -486,6 +488,20 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo)
|
||||
brelse(bp);
|
||||
}
|
||||
}
|
||||
|
||||
pager = (vm_pager_t)vp->v_vmdata;
|
||||
if (pager != NULL) {
|
||||
object = vm_object_lookup(pager);
|
||||
if (object) {
|
||||
vm_object_lock(object);
|
||||
if (flags & V_SAVE)
|
||||
vm_object_page_clean(object, 0, 0, TRUE, FALSE);
|
||||
vm_object_page_remove(object, 0, object->size);
|
||||
vm_object_unlock(object);
|
||||
vm_object_deallocate(object);
|
||||
}
|
||||
}
|
||||
|
||||
if (!(flags & V_SAVEMETA) &&
|
||||
(vp->v_dirtyblkhd.lh_first || vp->v_cleanblkhd.lh_first))
|
||||
panic("vinvalbuf: flush failed");
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vfs_subr.c 8.13 (Berkeley) 4/18/94
|
||||
* $Id: vfs_subr.c,v 1.6 1994/08/22 17:05:00 davidg Exp $
|
||||
* $Id: vfs_subr.c,v 1.7 1994/08/24 04:06:39 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -437,6 +437,8 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo)
|
||||
register struct buf *bp;
|
||||
struct buf *nbp, *blist;
|
||||
int s, error;
|
||||
vm_pager_t pager;
|
||||
vm_object_t object;
|
||||
|
||||
if (flags & V_SAVE) {
|
||||
if (error = VOP_FSYNC(vp, cred, MNT_WAIT, p))
|
||||
@ -445,7 +447,7 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo)
|
||||
panic("vinvalbuf: dirty bufs");
|
||||
}
|
||||
for (;;) {
|
||||
if ((blist = vp->v_cleanblkhd.lh_first) && flags & V_SAVEMETA)
|
||||
if ((blist = vp->v_cleanblkhd.lh_first) && (flags & V_SAVEMETA))
|
||||
while (blist && blist->b_lblkno < 0)
|
||||
blist = blist->b_vnbufs.le_next;
|
||||
if (!blist && (blist = vp->v_dirtyblkhd.lh_first) &&
|
||||
@ -457,7 +459,7 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo)
|
||||
|
||||
for (bp = blist; bp; bp = nbp) {
|
||||
nbp = bp->b_vnbufs.le_next;
|
||||
if (flags & V_SAVEMETA && bp->b_lblkno < 0)
|
||||
if ((flags & V_SAVEMETA) && bp->b_lblkno < 0)
|
||||
continue;
|
||||
s = splbio();
|
||||
if (bp->b_flags & B_BUSY) {
|
||||
@ -486,6 +488,20 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo)
|
||||
brelse(bp);
|
||||
}
|
||||
}
|
||||
|
||||
pager = (vm_pager_t)vp->v_vmdata;
|
||||
if (pager != NULL) {
|
||||
object = vm_object_lookup(pager);
|
||||
if (object) {
|
||||
vm_object_lock(object);
|
||||
if (flags & V_SAVE)
|
||||
vm_object_page_clean(object, 0, 0, TRUE, FALSE);
|
||||
vm_object_page_remove(object, 0, object->size);
|
||||
vm_object_unlock(object);
|
||||
vm_object_deallocate(object);
|
||||
}
|
||||
}
|
||||
|
||||
if (!(flags & V_SAVEMETA) &&
|
||||
(vp->v_dirtyblkhd.lh_first || vp->v_cleanblkhd.lh_first))
|
||||
panic("vinvalbuf: flush failed");
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_serv.c 8.3 (Berkeley) 1/12/94
|
||||
* $Id$
|
||||
* $Id: nfs_serv.c,v 1.3 1994/08/02 07:52:09 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -881,8 +881,7 @@ nfsrv_remove(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
error = EBUSY;
|
||||
goto out;
|
||||
}
|
||||
if (vp->v_flag & VTEXT)
|
||||
(void) vnode_pager_uncache(vp);
|
||||
(void) vnode_pager_uncache(vp);
|
||||
out:
|
||||
if (!error) {
|
||||
nqsrv_getl(nd.ni_dvp, NQL_WRITE);
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_vnops.c 8.5 (Berkeley) 2/13/94
|
||||
* $Id: nfs_vnops.c,v 1.3 1994/08/02 07:52:18 davidg Exp $
|
||||
* $Id: nfs_vnops.c,v 1.4 1994/08/08 17:30:53 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -339,11 +339,10 @@ nfs_open(ap)
|
||||
|
||||
if (vp->v_type != VREG && vp->v_type != VDIR && vp->v_type != VLNK)
|
||||
return (EACCES);
|
||||
if (vp->v_flag & VTEXT) {
|
||||
/*
|
||||
* Get a valid lease. If cached data is stale, flush it.
|
||||
*/
|
||||
if (nmp->nm_flag & NFSMNT_NQNFS) {
|
||||
/*
|
||||
* Get a valid lease. If cached data is stale, flush it.
|
||||
*/
|
||||
if (nmp->nm_flag & NFSMNT_NQNFS) {
|
||||
if (NQNFS_CKINVALID(vp, np, NQL_READ)) {
|
||||
do {
|
||||
error = nqnfs_getlease(vp, NQL_READ, ap->a_cred, ap->a_p);
|
||||
@ -355,16 +354,14 @@ nfs_open(ap)
|
||||
if ((error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred,
|
||||
ap->a_p, 1)) == EINTR)
|
||||
return (error);
|
||||
(void) vnode_pager_uncache(vp);
|
||||
np->n_brev = np->n_lrev;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
if (np->n_flag & NMODIFIED) {
|
||||
if ((error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred,
|
||||
ap->a_p, 1)) == EINTR)
|
||||
return (error);
|
||||
(void) vnode_pager_uncache(vp);
|
||||
np->n_attrstamp = 0;
|
||||
np->n_direofoffset = 0;
|
||||
if (error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_p))
|
||||
@ -378,12 +375,11 @@ nfs_open(ap)
|
||||
if ((error = nfs_vinvalbuf(vp, V_SAVE,
|
||||
ap->a_cred, ap->a_p, 1)) == EINTR)
|
||||
return (error);
|
||||
(void) vnode_pager_uncache(vp);
|
||||
np->n_mtime = vattr.va_mtime.ts_sec;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ((nmp->nm_flag & NFSMNT_NQNFS) == 0)
|
||||
}
|
||||
if ((nmp->nm_flag & NFSMNT_NQNFS) == 0)
|
||||
np->n_attrstamp = 0; /* For Open/Close consistency */
|
||||
return (0);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_vnops.c 8.5 (Berkeley) 2/13/94
|
||||
* $Id: nfs_vnops.c,v 1.3 1994/08/02 07:52:18 davidg Exp $
|
||||
* $Id: nfs_vnops.c,v 1.4 1994/08/08 17:30:53 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -339,11 +339,10 @@ nfs_open(ap)
|
||||
|
||||
if (vp->v_type != VREG && vp->v_type != VDIR && vp->v_type != VLNK)
|
||||
return (EACCES);
|
||||
if (vp->v_flag & VTEXT) {
|
||||
/*
|
||||
* Get a valid lease. If cached data is stale, flush it.
|
||||
*/
|
||||
if (nmp->nm_flag & NFSMNT_NQNFS) {
|
||||
/*
|
||||
* Get a valid lease. If cached data is stale, flush it.
|
||||
*/
|
||||
if (nmp->nm_flag & NFSMNT_NQNFS) {
|
||||
if (NQNFS_CKINVALID(vp, np, NQL_READ)) {
|
||||
do {
|
||||
error = nqnfs_getlease(vp, NQL_READ, ap->a_cred, ap->a_p);
|
||||
@ -355,16 +354,14 @@ nfs_open(ap)
|
||||
if ((error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred,
|
||||
ap->a_p, 1)) == EINTR)
|
||||
return (error);
|
||||
(void) vnode_pager_uncache(vp);
|
||||
np->n_brev = np->n_lrev;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
if (np->n_flag & NMODIFIED) {
|
||||
if ((error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred,
|
||||
ap->a_p, 1)) == EINTR)
|
||||
return (error);
|
||||
(void) vnode_pager_uncache(vp);
|
||||
np->n_attrstamp = 0;
|
||||
np->n_direofoffset = 0;
|
||||
if (error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_p))
|
||||
@ -378,12 +375,11 @@ nfs_open(ap)
|
||||
if ((error = nfs_vinvalbuf(vp, V_SAVE,
|
||||
ap->a_cred, ap->a_p, 1)) == EINTR)
|
||||
return (error);
|
||||
(void) vnode_pager_uncache(vp);
|
||||
np->n_mtime = vattr.va_mtime.ts_sec;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ((nmp->nm_flag & NFSMNT_NQNFS) == 0)
|
||||
}
|
||||
if ((nmp->nm_flag & NFSMNT_NQNFS) == 0)
|
||||
np->n_attrstamp = 0; /* For Open/Close consistency */
|
||||
return (0);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_serv.c 8.3 (Berkeley) 1/12/94
|
||||
* $Id$
|
||||
* $Id: nfs_serv.c,v 1.3 1994/08/02 07:52:09 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -881,8 +881,7 @@ nfsrv_remove(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
error = EBUSY;
|
||||
goto out;
|
||||
}
|
||||
if (vp->v_flag & VTEXT)
|
||||
(void) vnode_pager_uncache(vp);
|
||||
(void) vnode_pager_uncache(vp);
|
||||
out:
|
||||
if (!error) {
|
||||
nqsrv_getl(nd.ni_dvp, NQL_WRITE);
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vnode.h 8.7 (Berkeley) 2/4/94
|
||||
* $Id: vnode.h,v 1.2 1994/08/02 07:54:13 davidg Exp $
|
||||
* $Id: vnode.h,v 1.3 1994/08/21 04:42:15 paul Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_VNODE_H_
|
||||
@ -85,7 +85,6 @@ struct vnode {
|
||||
union {
|
||||
struct mount *vu_mountedhere;/* ptr to mounted vfs (VDIR) */
|
||||
struct socket *vu_socket; /* unix ipc (VSOCK) */
|
||||
caddr_t vu_vmdata; /* private data for vm (VREG) */
|
||||
struct specinfo *vu_specinfo; /* device (VCHR, VBLK) */
|
||||
struct fifoinfo *vu_fifoinfo; /* fifo (VFIFO) */
|
||||
} v_un;
|
||||
@ -96,13 +95,12 @@ struct vnode {
|
||||
int v_clen; /* length of current cluster */
|
||||
int v_ralen; /* Read-ahead length */
|
||||
daddr_t v_maxra; /* last readahead block */
|
||||
long v_spare[7]; /* round to 128 bytes */
|
||||
caddr_t v_vmdata; /* Place to store VM pager */
|
||||
enum vtagtype v_tag; /* type of underlying data */
|
||||
void *v_data; /* private data for fs */
|
||||
};
|
||||
#define v_mountedhere v_un.vu_mountedhere
|
||||
#define v_socket v_un.vu_socket
|
||||
#define v_vmdata v_un.vu_vmdata
|
||||
#define v_specinfo v_un.vu_specinfo
|
||||
#define v_fifoinfo v_un.vu_fifoinfo
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ffs_inode.c 8.5 (Berkeley) 12/30/93
|
||||
* $Id: ffs_inode.c,v 1.4 1994/08/02 13:51:05 davidg Exp $
|
||||
* $Id: ffs_inode.c,v 1.5 1994/08/03 08:19:35 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -190,7 +190,7 @@ ffs_truncate(ap)
|
||||
/*
|
||||
* Lengthen the size of the file. We must ensure that the
|
||||
* last byte of the file is allocated. Since the smallest
|
||||
* value of oszie is 0, length will be at least 1.
|
||||
* value of osize is 0, length will be at least 1.
|
||||
*/
|
||||
if (osize < length) {
|
||||
offset = blkoff(fs, length - 1);
|
||||
@ -202,7 +202,6 @@ ffs_truncate(ap)
|
||||
aflags))
|
||||
return (error);
|
||||
oip->i_size = length;
|
||||
(void) vnode_pager_uncache(ovp);
|
||||
if (aflags & IO_SYNC)
|
||||
bwrite(bp);
|
||||
else
|
||||
@ -230,7 +229,6 @@ ffs_truncate(ap)
|
||||
return (error);
|
||||
oip->i_size = length;
|
||||
size = blksize(fs, oip, lbn);
|
||||
(void) vnode_pager_uncache(ovp);
|
||||
bzero((char *)bp->b_data + offset, (u_int)(size - offset));
|
||||
allocbuf(bp, size);
|
||||
if (aflags & IO_SYNC)
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)lfs_alloc.c 8.4 (Berkeley) 1/4/94
|
||||
* $Id: lfs_alloc.c,v 1.2 1994/08/02 07:54:29 davidg Exp $
|
||||
* $Id: lfs_alloc.c,v 1.3 1994/08/20 03:49:00 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -99,7 +99,6 @@ lfs_valloc(ap)
|
||||
lfs_balloc(vp, fs->lfs_bsize, blkno, &bp);
|
||||
ip->i_size += fs->lfs_bsize;
|
||||
vnode_pager_setsize(vp, (u_long)ip->i_size);
|
||||
vnode_pager_uncache(vp);
|
||||
|
||||
i = (blkno - fs->lfs_segtabsz - fs->lfs_cleansz) *
|
||||
fs->lfs_ifpb;
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)lfs_inode.c 8.5 (Berkeley) 12/30/93
|
||||
* $Id$
|
||||
* $Id: lfs_inode.c,v 1.2 1994/08/02 07:54:35 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -217,7 +217,6 @@ lfs_truncate(ap)
|
||||
return (e1);
|
||||
ip->i_size = length;
|
||||
size = blksize(fs);
|
||||
(void)vnode_pager_uncache(vp);
|
||||
bzero((char *)bp->b_data + offset, (u_int)(size - offset));
|
||||
allocbuf(bp, size);
|
||||
if (e1 = VOP_BWRITE(bp))
|
||||
|
Loading…
Reference in New Issue
Block a user