Revert previous -- ALL reads are from kernel space.

Still open: PR kern/37425: fss_snapshot_mount panic during fsck.
This commit is contained in:
hannken 2008-12-07 18:55:58 +00:00
parent 10b1940363
commit 8e313cc27b

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs_snapshot.c,v 1.85 2008/12/07 10:01:09 hannken Exp $ */
/* $NetBSD: ffs_snapshot.c,v 1.86 2008/12/07 18:55:58 hannken Exp $ */
/*
* Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.85 2008/12/07 10:01:09 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.86 2008/12/07 18:55:58 hannken Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@ -1783,7 +1783,7 @@ ffs_copyonwrite(void *v, struct buf *bp, bool data_valid)
return 0;
}
snapblklist = si->si_snapblklist;
upper = (snapblklist != NULL ? snapblklist[0] - 1 : 0);
upper = si->si_snapblklist[0] - 1;
lower = 1;
while (lower <= upper) {
mid = (lower + upper) / 2;
@ -1949,10 +1949,7 @@ ffs_snapshot_read(struct vnode *vp, struct uio *uio, int ioflag)
fstrans_start(vp->v_mount, FSTRANS_SHARED);
mutex_enter(&si->si_snaplock);
if (VMSPACE_IS_KERNEL_P(uio->uio_vmspace))
fsbytes = ip->i_size;
else
fsbytes = lfragtosize(fs, fs->fs_size);
fsbytes = lfragtosize(fs, fs->fs_size);
for (error = 0, bp = NULL; uio->uio_resid > 0; bp = NULL) {
bytesinfile = fsbytes - uio->uio_offset;
if (bytesinfile <= 0)
@ -1966,8 +1963,7 @@ ffs_snapshot_read(struct vnode *vp, struct uio *uio, int ioflag)
if (lblktosize(fs, nextlbn + 1) >= fsbytes) {
if (lblktosize(fs, lbn) + size > fsbytes)
size = fragroundup(fs,
fsbytes - lblktosize(fs, lbn));
size = fsbytes - lblktosize(fs, lbn);
error = bread(vp, lbn, size, NOCRED, 0, &bp);
} else {
int nextsize = fs->fs_bsize;