diff options
author | dyson <dyson@FreeBSD.org> | 1995-11-19 20:24:15 +0000 |
---|---|---|
committer | dyson <dyson@FreeBSD.org> | 1995-11-19 20:24:15 +0000 |
commit | 8a10737211f48e9d0aacf793e8942b5d2fcd47b2 (patch) | |
tree | 4ce311f4ff957118a9c6238aeec96997da4f3907 /sys/gnu/fs | |
parent | 13fde74b24ca1d0d51449b38e301ae77a023addf (diff) | |
download | FreeBSD-src-8a10737211f48e9d0aacf793e8942b5d2fcd47b2.zip FreeBSD-src-8a10737211f48e9d0aacf793e8942b5d2fcd47b2.tar.gz |
Correct some serious porting errors. The worst one was that the
vnode was being placed upon the mount point twice!!!
Diffstat (limited to 'sys/gnu/fs')
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_readwrite.c | 17 | ||||
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_vfsops.c | 29 | ||||
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_vnops.c | 4 |
3 files changed, 41 insertions, 9 deletions
diff --git a/sys/gnu/fs/ext2fs/ext2_readwrite.c b/sys/gnu/fs/ext2fs/ext2_readwrite.c index be01831..8deb0b1 100644 --- a/sys/gnu/fs/ext2fs/ext2_readwrite.c +++ b/sys/gnu/fs/ext2fs/ext2_readwrite.c @@ -137,10 +137,12 @@ READ(ap) break; xfersize = size; } - if (error = - uiomove((char *)bp->b_data + blkoffset, (int)xfersize, uio)) - break; - + if (uio->uio_segflg != UIO_NOCOPY) + ip->i_flag |= IN_RECURSE; + error = + uiomove((char *)bp->b_data + blkoffset, (int)xfersize, uio); + if (uio->uio_segflg != UIO_NOCOPY) + ip->i_flag &= ~IN_RECURSE; #if !defined(__FreeBSD__) if (S_ISREG(mode) && (xfersize + blkoffset == fs->s_frag_size || uio->uio_offset == ip->i_size)) @@ -261,8 +263,12 @@ WRITE(ap) if (size < xfersize) xfersize = size; + if (uio->uio_segflg != UIO_NOCOPY) + ip->i_flag |= IN_RECURSE; error = uiomove((char *)bp->b_data + blkoffset, (int)xfersize, uio); + if (uio->uio_segflg != UIO_NOCOPY) + ip->i_flag &= ~IN_RECURSE; if (ioflag & IO_SYNC) (void)bwrite(bp); @@ -280,7 +286,8 @@ WRITE(ap) } } else { #if defined(__FreeBSD__) - bp->b_flags |= B_CLUSTEROK; + if (doclusterwrite) + bp->b_flags |= B_CLUSTEROK; #endif bdwrite(bp); } diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c index 048b83f..8b12631 100644 --- a/sys/gnu/fs/ext2fs/ext2_vfsops.c +++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c @@ -95,6 +95,9 @@ VFS_SET(ext2fs_vfsops, ext2fs, MOUNT_EXT2FS, 0); #endif extern u_long nextgennumber; +#ifdef __FreeBSD__ +int ext2fs_inode_hash_lock; +#endif /* * Called by main() when ufs is going to be mounted as root. @@ -887,9 +890,26 @@ ext2_vget(mp, ino, vpp) ump = VFSTOUFS(mp); dev = ump->um_dev; +restart: if ((*vpp = ufs_ihashget(dev, ino)) != NULL) return (0); +#ifdef __FreeBSD__ + /* + * Lock out the creation of new entries in the FFS hash table in + * case getnewvnode() or MALLOC() blocks, otherwise a duplicate + * may occur! + */ + if (ext2fs_inode_hash_lock) { + while (ext2fs_inode_hash_lock) { + ext2fs_inode_hash_lock = -1; + tsleep(&ext2fs_inode_hash_lock, PVM, "ffsvgt", 0); + } + goto restart; + } + ext2fs_inode_hash_lock = 1; +#endif + /* Allocate a new vnode/inode. */ if (error = getnewvnode(VT_UFS, mp, ext2_vnodeop_p, &vp)) { *vpp = NULL; @@ -901,7 +921,9 @@ ext2_vget(mp, ino, vpp) */ type = ump->um_devvp->v_tag == VT_MFS ? M_MFSNODE : M_FFSNODE; /* XXX */ MALLOC(ip, struct inode *, sizeof(struct inode), type, M_WAITOK); +#ifndef __FreeBSD__ insmntque(vp, mp); +#endif bzero((caddr_t)ip, sizeof(struct inode)); vp->v_data = ip; ip->i_vnode = vp; @@ -920,6 +942,13 @@ ext2_vget(mp, ino, vpp) */ ufs_ihashins(ip); +#ifdef __FreeBSD__ + if (ext2fs_inode_hash_lock < 0) + wakeup(&ext2fs_inode_hash_lock); + ext2fs_inode_hash_lock = 0; +#endif + + /* Read in the disk contents for the inode, copy into the inode. */ /* Read in the disk contents for the inode, copy into the inode. */ #if 0 printf("ext2_vget(%d) dbn= %d ", ino, fsbtodb(fs, ino_to_fsba(fs, ino))); diff --git a/sys/gnu/fs/ext2fs/ext2_vnops.c b/sys/gnu/fs/ext2fs/ext2_vnops.c index a103388..07ed818 100644 --- a/sys/gnu/fs/ext2fs/ext2_vnops.c +++ b/sys/gnu/fs/ext2fs/ext2_vnops.c @@ -177,7 +177,6 @@ struct vnodeopv_entry_desc ext2_specop_entries[] = { struct vnodeopv_desc ext2fs_specop_opv_desc = { &ext2_specop_p, ext2_specop_entries }; -#if FIFO vop_t **ext2_fifoop_p; struct vnodeopv_entry_desc ext2_fifoop_entries[] = { { &vop_default_desc, (vop_t *)vn_default_error }, @@ -226,15 +225,12 @@ struct vnodeopv_entry_desc ext2_fifoop_entries[] = { }; struct vnodeopv_desc ext2fs_fifoop_opv_desc = { &ext2_fifoop_p, ext2_fifoop_entries }; -#endif /* FIFO */ #if defined(__FreeBSD__) VNODEOP_SET(ext2fs_vnodeop_opv_desc); VNODEOP_SET(ext2fs_specop_opv_desc); -#if FIFO VNODEOP_SET(ext2fs_fifoop_opv_desc); #endif -#endif /* * Enabling cluster read/write operations. |