If a large (>4096 bytes) directory was modified, the old directory
contents are discarded, including the cached seek cookies. Unfortunately, if the directory was larger than NFS_DIRBLKSIZ, then this confused nfs_readdirrpc(), making it appear as if the directory was truncated. Reviewed by: Karl Denninger <karl@Mcs.Net>
This commit is contained in:
parent
bf6570c4a5
commit
425b5191a4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=19070
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_bio.c 8.5 (Berkeley) 1/4/94
|
||||
* $Id: nfs_bio.c,v 1.26 1996/10/11 10:15:30 dfr Exp $
|
||||
* $Id: nfs_bio.c,v 1.27 1996/10/12 17:39:39 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -319,6 +319,7 @@ nfs_bioread(vp, uio, ioflag, cred)
|
||||
vfs_busy_pages(bp, 0);
|
||||
error = nfs_doio(bp, cred, p);
|
||||
if (error) {
|
||||
vfs_unbusy_pages(bp);
|
||||
brelse(bp);
|
||||
while (error == NFSERR_BAD_COOKIE) {
|
||||
nfs_invaldir(vp);
|
||||
@ -337,7 +338,10 @@ nfs_bioread(vp, uio, ioflag, cred)
|
||||
bp->b_flags |= B_READ;
|
||||
vfs_busy_pages(bp, 0);
|
||||
error = nfs_doio(bp, cred, p);
|
||||
if (error)
|
||||
if (error) {
|
||||
vfs_unbusy_pages(bp);
|
||||
brelse(bp);
|
||||
} else if (i < lbn)
|
||||
brelse(bp);
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_vnops.c 8.5 (Berkeley) 2/13/94
|
||||
* $Id: nfs_vnops.c,v 1.34 1996/07/16 10:19:45 dfr Exp $
|
||||
* $Id: nfs_vnops.c,v 1.35 1996/09/19 18:21:01 nate Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -2066,13 +2066,13 @@ nfs_readdirrpc(vp, uiop, cred)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If there is no cookie, assume end of directory.
|
||||
* If there is no cookie, assume directory was stale.
|
||||
*/
|
||||
cookiep = nfs_getcookie(dnp, uiop->uio_offset, 0);
|
||||
if (cookiep)
|
||||
cookie = *cookiep;
|
||||
else
|
||||
return (0);
|
||||
return (NFSERR_BAD_COOKIE);
|
||||
/*
|
||||
* Loop around doing readdir rpc's of size nm_readdirsize
|
||||
* truncated to a multiple of DIRBLKSIZ.
|
||||
@ -2255,13 +2255,13 @@ nfs_readdirplusrpc(vp, uiop, cred)
|
||||
newvp = NULLVP;
|
||||
|
||||
/*
|
||||
* If there is no cookie, assume end of directory.
|
||||
* If there is no cookie, assume directory was stale.
|
||||
*/
|
||||
cookiep = nfs_getcookie(dnp, uiop->uio_offset, 0);
|
||||
if (cookiep)
|
||||
cookie = *cookiep;
|
||||
else
|
||||
return (0);
|
||||
return (NFSERR_BAD_COOKIE);
|
||||
/*
|
||||
* Loop around doing readdir rpc's of size nm_readdirsize
|
||||
* truncated to a multiple of DIRBLKSIZ.
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_bio.c 8.5 (Berkeley) 1/4/94
|
||||
* $Id: nfs_bio.c,v 1.26 1996/10/11 10:15:30 dfr Exp $
|
||||
* $Id: nfs_bio.c,v 1.27 1996/10/12 17:39:39 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -319,6 +319,7 @@ nfs_bioread(vp, uio, ioflag, cred)
|
||||
vfs_busy_pages(bp, 0);
|
||||
error = nfs_doio(bp, cred, p);
|
||||
if (error) {
|
||||
vfs_unbusy_pages(bp);
|
||||
brelse(bp);
|
||||
while (error == NFSERR_BAD_COOKIE) {
|
||||
nfs_invaldir(vp);
|
||||
@ -337,7 +338,10 @@ nfs_bioread(vp, uio, ioflag, cred)
|
||||
bp->b_flags |= B_READ;
|
||||
vfs_busy_pages(bp, 0);
|
||||
error = nfs_doio(bp, cred, p);
|
||||
if (error)
|
||||
if (error) {
|
||||
vfs_unbusy_pages(bp);
|
||||
brelse(bp);
|
||||
} else if (i < lbn)
|
||||
brelse(bp);
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_vnops.c 8.5 (Berkeley) 2/13/94
|
||||
* $Id: nfs_vnops.c,v 1.34 1996/07/16 10:19:45 dfr Exp $
|
||||
* $Id: nfs_vnops.c,v 1.35 1996/09/19 18:21:01 nate Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -2066,13 +2066,13 @@ nfs_readdirrpc(vp, uiop, cred)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If there is no cookie, assume end of directory.
|
||||
* If there is no cookie, assume directory was stale.
|
||||
*/
|
||||
cookiep = nfs_getcookie(dnp, uiop->uio_offset, 0);
|
||||
if (cookiep)
|
||||
cookie = *cookiep;
|
||||
else
|
||||
return (0);
|
||||
return (NFSERR_BAD_COOKIE);
|
||||
/*
|
||||
* Loop around doing readdir rpc's of size nm_readdirsize
|
||||
* truncated to a multiple of DIRBLKSIZ.
|
||||
@ -2255,13 +2255,13 @@ nfs_readdirplusrpc(vp, uiop, cred)
|
||||
newvp = NULLVP;
|
||||
|
||||
/*
|
||||
* If there is no cookie, assume end of directory.
|
||||
* If there is no cookie, assume directory was stale.
|
||||
*/
|
||||
cookiep = nfs_getcookie(dnp, uiop->uio_offset, 0);
|
||||
if (cookiep)
|
||||
cookie = *cookiep;
|
||||
else
|
||||
return (0);
|
||||
return (NFSERR_BAD_COOKIE);
|
||||
/*
|
||||
* Loop around doing readdir rpc's of size nm_readdirsize
|
||||
* truncated to a multiple of DIRBLKSIZ.
|
||||
|
Loading…
Reference in New Issue
Block a user