diff options
author | peadar <peadar@FreeBSD.org> | 2005-01-27 13:50:27 +0000 |
---|---|---|
committer | peadar <peadar@FreeBSD.org> | 2005-01-27 13:50:27 +0000 |
commit | 80f3d1cb457b8b12ec5b66dc0878a60229d7e187 (patch) | |
tree | aa8b5b038efa85d8a818ccc6e683307ae0d531f4 /sys/fs/ntfs/ntfs_vfsops.c | |
parent | e0ac0a48cd5f9e54521f1dc133f9fc10bee873fc (diff) | |
download | FreeBSD-src-80f3d1cb457b8b12ec5b66dc0878a60229d7e187.zip FreeBSD-src-80f3d1cb457b8b12ec5b66dc0878a60229d7e187.tar.gz |
Make NTFS at least minimally usable after bufobj and GEOM fallout.
mmap() on NTFS files was hosed, returning pages offset from the
start of the disk rather than the start of the file. (ie, "cp" of
a 1-block file would get you a copy of the boot sector, not the
data in the file.) The solution isn't ideal, but gives a functioning
filesystem.
Cached vnode lookup was also broken, resulting in vnode haemorrhage.
A lookup on the same file twice would give you two vnodes, and the
resulting cached pages.
Just recently, mmap() was broken due to a lack of a call to
vnode_create_vobject() in ntfs_open().
Discussed with: phk@
Diffstat (limited to 'sys/fs/ntfs/ntfs_vfsops.c')
-rw-r--r-- | sys/fs/ntfs/ntfs_vfsops.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c index 1c2e6bd..60cd7b5 100644 --- a/sys/fs/ntfs/ntfs_vfsops.c +++ b/sys/fs/ntfs/ntfs_vfsops.c @@ -81,6 +81,19 @@ static vfs_statfs_t ntfs_statfs; static vfs_unmount_t ntfs_unmount; static vfs_vptofh_t ntfs_vptofh; +static b_strategy_t ntfs_bufstrategy; + +/* + * Buffer operations for NTFS vnodes. + * We punt on VOP_BMAP, so we need to do + * strategy on the file's vnode rather + * than the underlying device's + */ +static struct buf_ops ntfs_vnbufops = { + .bop_name = "NTFS", + .bop_strategy = ntfs_bufstrategy, +}; + static int ntfs_init ( struct vfsconf *vcp ) @@ -650,7 +663,7 @@ ntfs_vgetex( dprintf(("ntfs_vgetex: ino: %d, attr: 0x%x:%s, lkf: 0x%lx, f: 0x%lx\n", ino, attrtype, attrname?attrname:"", (u_long)lkflags, - (u_long)flags )); + (u_long)flags)); ntmp = VFSTONTFS(mp); *vpp = NULL; @@ -721,6 +734,9 @@ ntfs_vgetex( vp->v_data = fp; vp->v_type = f_type; + vp->v_bufobj.bo_ops = &ntfs_vnbufops; + vp->v_bufobj.bo_private = vp; + if (ino == NTFS_ROOTINO) vp->v_vflag |= VV_ROOT; @@ -750,6 +766,20 @@ ntfs_vget( curthread, vpp); } +static void +ntfs_bufstrategy(struct bufobj *bo, struct buf *bp) +{ + struct vnode *vp; + int rc; + + vp = bo->bo_private; + KASSERT(bo == &vp->v_bufobj, ("BO/VP mismatch: vp %p bo %p != %p", + vp, &vp->v_bufobj, bo)); + rc = VOP_STRATEGY(vp, bp); + KASSERT(rc == 0, ("NTFS VOP_STRATEGY failed: bp=%p, " + "vp=%p, rc=%d", bp, vp, rc)); +} + static struct vfsops ntfs_vfsops = { .vfs_fhtovp = ntfs_fhtovp, .vfs_init = ntfs_init, |