mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-12 14:29:28 +00:00
Correct some serious porting errors. The worst one was that the
vnode was being placed upon the mount point twice!!!
This commit is contained in:
parent
aa3960192e
commit
b0a50fff55
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=12406
@ -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);
|
||||
}
|
||||
|
@ -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)));
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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)));
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user