Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/nfs - do FILESYNC writes if we're freeing the page or th...
details: https://anonhg.NetBSD.org/src/rev/c48f31c01180
branches: trunk
changeset: 545623:c48f31c01180
user: yamt <yamt%NetBSD.org@localhost>
date: Sat Apr 12 06:53:09 2003 +0000
description:
- do FILESYNC writes if we're freeing the page or the page doesn't
belong to us. otherwise, data will be lost on server crash.
- use b_bcount instead of b_bufsize to determine
how many pages we should deal with.
based on a patch from Chuck Silvers.
discussed on tech-kern.
diffstat:
sys/nfs/nfs_bio.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diffs (44 lines):
diff -r 6dc1b2f7ea82 -r c48f31c01180 sys/nfs/nfs_bio.c
--- a/sys/nfs/nfs_bio.c Sat Apr 12 06:42:38 2003 +0000
+++ b/sys/nfs/nfs_bio.c Sat Apr 12 06:53:09 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs_bio.c,v 1.89 2003/04/09 14:30:30 yamt Exp $ */
+/* $NetBSD: nfs_bio.c,v 1.90 2003/04/12 06:53:09 yamt Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.89 2003/04/09 14:30:30 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.90 2003/04/12 06:53:09 yamt Exp $");
#include "opt_nfs.h"
#include "opt_ddb.h"
@@ -990,7 +990,7 @@
bp->b_error = error;
}
} else {
- int i, npages = bp->b_bufsize >> PAGE_SHIFT;
+ int i, npages = (bp->b_bcount + PAGE_SIZE - 1) >> PAGE_SHIFT;
struct vm_page *pgs[npages];
boolean_t needcommit = TRUE;
@@ -1003,9 +1003,16 @@
for (i = 0; i < npages; i++) {
pgs[i] = uvm_pageratop((vaddr_t)bp->b_data +
(i << PAGE_SHIFT));
+ KASSERT((pgs[i]->flags & PG_BUSY) ||
+ pgs[i]->uobject != (struct uvm_object *)vp);
if ((pgs[i]->flags & PG_NEEDCOMMIT) == 0) {
needcommit = FALSE;
}
+ if ((pgs[i]->flags & (PG_RELEASED|PG_PAGEOUT)) ||
+ pgs[i]->uobject != (struct uvm_object *)vp) {
+ KASSERT(i == 0 || iomode == NFSV3WRITE_FILESYNC);
+ iomode = NFSV3WRITE_FILESYNC;
+ }
}
if (!needcommit && iomode == NFSV3WRITE_UNSTABLE) {
for (i = 0; i < npages; i++) {
Home |
Main Index |
Thread Index |
Old Index