mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 03:49:02 +00:00
Since ufs_ihashget can block, the lock must be checked for each time
the function returns. Also, moved lock into .bss and made minor cosmetic changes. Submitted by: Bruce Evans
This commit is contained in:
parent
d83f358fa3
commit
8997d94f79
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=9618
@ -31,7 +31,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)ffs_vfsops.c 8.8 (Berkeley) 4/18/94
|
* @(#)ffs_vfsops.c 8.8 (Berkeley) 4/18/94
|
||||||
* $Id: ffs_vfsops.c,v 1.23 1995/07/13 08:48:05 davidg Exp $
|
* $Id: ffs_vfsops.c,v 1.24 1995/07/21 03:52:40 davidg Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -737,8 +737,7 @@ loop:
|
|||||||
* return the inode locked. Detection and handling of mount points must be
|
* return the inode locked. Detection and handling of mount points must be
|
||||||
* done by the calling routine.
|
* done by the calling routine.
|
||||||
*/
|
*/
|
||||||
|
int ffs_inode_hash_lock;
|
||||||
int ffs_inode_hash_lock = 0;
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ffs_vget(mp, ino, vpp)
|
ffs_vget(mp, ino, vpp)
|
||||||
@ -756,12 +755,13 @@ ffs_vget(mp, ino, vpp)
|
|||||||
|
|
||||||
ump = VFSTOUFS(mp);
|
ump = VFSTOUFS(mp);
|
||||||
dev = ump->um_dev;
|
dev = ump->um_dev;
|
||||||
|
restart:
|
||||||
if ((*vpp = ufs_ihashget(dev, ino)) != NULL)
|
if ((*vpp = ufs_ihashget(dev, ino)) != NULL)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lockout the creation of new entries in the FFS hash table
|
* Lock out the creation of new entries in the FFS hash table in
|
||||||
* in case getnewvnode/MALLOC blocks, otherwise a duplicate
|
* case getnewvnode() or MALLOC() blocks, otherwise a duplicate
|
||||||
* may occur!
|
* may occur!
|
||||||
*/
|
*/
|
||||||
if (ffs_inode_hash_lock) {
|
if (ffs_inode_hash_lock) {
|
||||||
@ -769,17 +769,15 @@ ffs_vget(mp, ino, vpp)
|
|||||||
ffs_inode_hash_lock = -1;
|
ffs_inode_hash_lock = -1;
|
||||||
tsleep(&ffs_inode_hash_lock, PVM, "ffsvgt", 0);
|
tsleep(&ffs_inode_hash_lock, PVM, "ffsvgt", 0);
|
||||||
}
|
}
|
||||||
if ((*vpp = ufs_ihashget(dev, ino)) != NULL)
|
goto restart;
|
||||||
return (0);
|
|
||||||
}
|
}
|
||||||
ffs_inode_hash_lock = 1;
|
ffs_inode_hash_lock = 1;
|
||||||
|
|
||||||
/* Allocate a new vnode/inode. */
|
/* Allocate a new vnode/inode. */
|
||||||
error = getnewvnode(VT_UFS, mp, ffs_vnodeop_p, &vp);
|
error = getnewvnode(VT_UFS, mp, ffs_vnodeop_p, &vp);
|
||||||
if (error) {
|
if (error) {
|
||||||
if (ffs_inode_hash_lock < 0) {
|
if (ffs_inode_hash_lock < 0)
|
||||||
wakeup(&ffs_inode_hash_lock);
|
wakeup(&ffs_inode_hash_lock);
|
||||||
}
|
|
||||||
ffs_inode_hash_lock = 0;
|
ffs_inode_hash_lock = 0;
|
||||||
*vpp = NULL;
|
*vpp = NULL;
|
||||||
return (error);
|
return (error);
|
||||||
@ -807,12 +805,8 @@ ffs_vget(mp, ino, vpp)
|
|||||||
*/
|
*/
|
||||||
ufs_ihashins(ip);
|
ufs_ihashins(ip);
|
||||||
|
|
||||||
/*
|
if (ffs_inode_hash_lock < 0)
|
||||||
* Wakeup anybody blocked on our lock
|
|
||||||
*/
|
|
||||||
if (ffs_inode_hash_lock < 0) {
|
|
||||||
wakeup(&ffs_inode_hash_lock);
|
wakeup(&ffs_inode_hash_lock);
|
||||||
}
|
|
||||||
ffs_inode_hash_lock = 0;
|
ffs_inode_hash_lock = 0;
|
||||||
|
|
||||||
/* Read in the disk contents for the inode, copy into the inode. */
|
/* Read in the disk contents for the inode, copy into the inode. */
|
||||||
|
Loading…
Reference in New Issue
Block a user