From 407a63dc34297d65974ac4008c776a8e5ce62430 Mon Sep 17 00:00:00 2001 From: yamt Date: Thu, 27 Jan 2005 11:29:25 +0000 Subject: [PATCH] nfs_bioread: - if a buffer is still empty after successful nfs_doio, it implies EOF. - don't cache blocks beyond EOF. --- sys/nfs/nfs_bio.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c index 6f423e950166..474c3e6fb3c6 100644 --- a/sys/nfs/nfs_bio.c +++ b/sys/nfs/nfs_bio.c @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_bio.c,v 1.125 2005/01/26 10:30:58 yamt Exp $ */ +/* $NetBSD: nfs_bio.c,v 1.126 2005/01/27 11:29:25 yamt Exp $ */ /* * Copyright (c) 1989, 1993 @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.125 2005/01/26 10:30:58 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.126 2005/01/27 11:29:25 yamt Exp $"); #include "opt_nfs.h" #include "opt_ddb.h" @@ -284,6 +284,18 @@ diragain: } } + if (bp->b_bcount == bp->b_resid) { + + /* + * empty block implies EOF. + */ + + nfs_putdircache(np, ndp); + bp->b_flags |= B_NOCACHE; + brelse(bp); + return 0; + } + /* * Just return if we hit EOF right away with this * block. Always check here, because direofoffset @@ -293,6 +305,7 @@ diragain: if (NFS_EOFVALID(np) && ndp->dc_blkcookie == np->n_direofoffset) { nfs_putdircache(np, ndp); + bp->b_flags |= B_NOCACHE; brelse(bp); return (0); }