From 363880128ccbbc0bdf15c6ccd01a5adb0c421bc1 Mon Sep 17 00:00:00 2001 From: Doug Rabson Date: Thu, 3 Apr 1997 07:52:00 +0000 Subject: [PATCH] The code which recovered from a modified directory situation did not check for eof when re-caching the directory. This could cause it to loop forever if a directory was truncated. --- sys/nfs/nfs_bio.c | 9 ++++++++- sys/nfsclient/nfs_bio.c | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c index e44450fa24fa..b5912b585724 100644 --- a/sys/nfs/nfs_bio.c +++ b/sys/nfs/nfs_bio.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_bio.c 8.9 (Berkeley) 3/30/95 - * $Id: nfs_bio.c,v 1.32 1997/02/22 09:42:35 peter Exp $ + * $Id: nfs_bio.c,v 1.33 1997/03/09 10:21:26 bde Exp $ */ @@ -293,6 +293,10 @@ nfs_bioread(vp, uio, ioflag, cred) break; case VDIR: nfsstats.biocache_readdirs++; + if (np->n_direofoffset + && uio->uio_offset >= np->n_direofoffset) { + return (0); + } lbn = uio->uio_offset / NFS_DIRBLKSIZ; on = uio->uio_offset & (NFS_DIRBLKSIZ - 1); bp = nfs_getcacheblk(vp, lbn, NFS_DIRBLKSIZ, p); @@ -315,6 +319,9 @@ nfs_bioread(vp, uio, ioflag, cred) * offset cookies. */ for (i = 0; i <= lbn && !error; i++) { + if (np->n_direofoffset + && (i * NFS_DIRBLKSIZ) >= np->n_direofoffset) + return (0); bp = nfs_getcacheblk(vp, i, NFS_DIRBLKSIZ, p); if (!bp) return (EINTR); diff --git a/sys/nfsclient/nfs_bio.c b/sys/nfsclient/nfs_bio.c index e44450fa24fa..b5912b585724 100644 --- a/sys/nfsclient/nfs_bio.c +++ b/sys/nfsclient/nfs_bio.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_bio.c 8.9 (Berkeley) 3/30/95 - * $Id: nfs_bio.c,v 1.32 1997/02/22 09:42:35 peter Exp $ + * $Id: nfs_bio.c,v 1.33 1997/03/09 10:21:26 bde Exp $ */ @@ -293,6 +293,10 @@ nfs_bioread(vp, uio, ioflag, cred) break; case VDIR: nfsstats.biocache_readdirs++; + if (np->n_direofoffset + && uio->uio_offset >= np->n_direofoffset) { + return (0); + } lbn = uio->uio_offset / NFS_DIRBLKSIZ; on = uio->uio_offset & (NFS_DIRBLKSIZ - 1); bp = nfs_getcacheblk(vp, lbn, NFS_DIRBLKSIZ, p); @@ -315,6 +319,9 @@ nfs_bioread(vp, uio, ioflag, cred) * offset cookies. */ for (i = 0; i <= lbn && !error; i++) { + if (np->n_direofoffset + && (i * NFS_DIRBLKSIZ) >= np->n_direofoffset) + return (0); bp = nfs_getcacheblk(vp, i, NFS_DIRBLKSIZ, p); if (!bp) return (EINTR);