diff options
| author | John Dyson <dyson@FreeBSD.org> | 1995-04-24 05:13:28 +0000 |
|---|---|---|
| committer | John Dyson <dyson@FreeBSD.org> | 1995-04-24 05:13:28 +0000 |
| commit | e5f751a9b29d8ecbe528c905ae7e4dc126be08d3 (patch) | |
| tree | 39ede7ea7b438469ee1ceefc7b7ccbd8d3d1ae86 /sys/gnu | |
| parent | 4ac5f605723c21e5c33588188f9e3bcb1e689009 (diff) | |
Notes
Diffstat (limited to 'sys/gnu')
| -rw-r--r-- | sys/gnu/ext2fs/ext2_ihash.c | 24 | ||||
| -rw-r--r-- | sys/gnu/ext2fs/inode.h | 6 | ||||
| -rw-r--r-- | sys/gnu/fs/ext2fs/inode.h | 6 |
3 files changed, 25 insertions, 11 deletions
diff --git a/sys/gnu/ext2fs/ext2_ihash.c b/sys/gnu/ext2fs/ext2_ihash.c index ce5b0f8d8e106..18ac11c406223 100644 --- a/sys/gnu/ext2fs/ext2_ihash.c +++ b/sys/gnu/ext2fs/ext2_ihash.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ufs_ihash.c 8.4 (Berkeley) 12/30/93 - * $Id: ufs_ihash.c,v 1.3 1994/10/06 21:07:01 davidg Exp $ + * $Id: ufs_ihash.c,v 1.4 1994/10/08 06:57:23 phk Exp $ */ #include <sys/param.h> @@ -99,9 +99,15 @@ ufs_ihashget(device, inum) return (NULL); if (inum == ip->i_number && device == ip->i_dev) { if (ip->i_flag & IN_LOCKED) { - ip->i_flag |= IN_WANTED; - (void) tsleep(ip, PINOD, "uihget", 0); - break; + if( curproc->p_pid != ip->i_lockholder) { + ip->i_flag |= IN_WANTED; + (void) tsleep(ip, PINOD, "uihget", 0); + break; + } else if (ip->i_flag & IN_RECURSE) { + ip->i_lockcount++; + } else { + panic("ufs_ihashget: recursive lock not expected -- pid %d\n", ip->i_lockholder); + } } vp = ITOV(ip); if (!vget(vp, 1)) @@ -128,12 +134,16 @@ ufs_ihashins(ip) ip->i_next = iq; ip->i_prev = ipp; *ipp = ip; - if (ip->i_flag & IN_LOCKED) + if ((ip->i_flag & IN_LOCKED) && + ((ip->i_flag & IN_RECURSE) == 0 || + (!curproc || (curproc && (ip->i_lockholder != curproc->p_pid))))) panic("ufs_ihashins: already locked"); - if (curproc) + if (curproc) { + ip->i_lockcount += 1; ip->i_lockholder = curproc->p_pid; - else + } else { ip->i_lockholder = -1; + } ip->i_flag |= IN_LOCKED; } diff --git a/sys/gnu/ext2fs/inode.h b/sys/gnu/ext2fs/inode.h index 16467926e7fe1..f0c729769c8b3 100644 --- a/sys/gnu/ext2fs/inode.h +++ b/sys/gnu/ext2fs/inode.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)inode.h 8.4 (Berkeley) 1/21/94 - * $Id: inode.h,v 1.3 1994/08/21 07:16:15 paul Exp $ + * $Id: inode.h,v 1.4 1994/12/27 13:59:14 bde Exp $ */ #ifndef _UFS_UFS_INODE_H_ @@ -91,7 +91,8 @@ struct inode { doff_t i_offset; /* Offset of free space in directory. */ ino_t i_ino; /* Inode number of found directory. */ u_long i_reclen; /* Size of found directory entry. */ - long i_spare[11]; /* Spares to round up to 128 bytes. */ + int i_lockcount; /* Process lock count (recursion) */ + long i_spare[10]; /* Spares to round up to 128 bytes. */ /* * The on-disk dinode itself. */ @@ -125,6 +126,7 @@ struct inode { #define IN_SHLOCK 0x0080 /* File has shared lock. */ #define IN_UPDATE 0x0100 /* Modification time update request. */ #define IN_WANTED 0x0200 /* Inode is wanted by a process. */ +#define IN_RECURSE 0x0400 /* Recursion expected */ #ifdef KERNEL /* diff --git a/sys/gnu/fs/ext2fs/inode.h b/sys/gnu/fs/ext2fs/inode.h index 16467926e7fe1..f0c729769c8b3 100644 --- a/sys/gnu/fs/ext2fs/inode.h +++ b/sys/gnu/fs/ext2fs/inode.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)inode.h 8.4 (Berkeley) 1/21/94 - * $Id: inode.h,v 1.3 1994/08/21 07:16:15 paul Exp $ + * $Id: inode.h,v 1.4 1994/12/27 13:59:14 bde Exp $ */ #ifndef _UFS_UFS_INODE_H_ @@ -91,7 +91,8 @@ struct inode { doff_t i_offset; /* Offset of free space in directory. */ ino_t i_ino; /* Inode number of found directory. */ u_long i_reclen; /* Size of found directory entry. */ - long i_spare[11]; /* Spares to round up to 128 bytes. */ + int i_lockcount; /* Process lock count (recursion) */ + long i_spare[10]; /* Spares to round up to 128 bytes. */ /* * The on-disk dinode itself. */ @@ -125,6 +126,7 @@ struct inode { #define IN_SHLOCK 0x0080 /* File has shared lock. */ #define IN_UPDATE 0x0100 /* Modification time update request. */ #define IN_WANTED 0x0200 /* Inode is wanted by a process. */ +#define IN_RECURSE 0x0400 /* Recursion expected */ #ifdef KERNEL /* |
