summaryrefslogtreecommitdiffstats
path: root/sys/gnu
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1995-04-24 05:13:28 +0000
committerdyson <dyson@FreeBSD.org>1995-04-24 05:13:28 +0000
commitc6edfe5c180f2234113c64e6c92e3e31920e7c57 (patch)
tree39ede7ea7b438469ee1ceefc7b7ccbd8d3d1ae86 /sys/gnu
parent10b29892d61a6a01b00290484e0445d700224e16 (diff)
downloadFreeBSD-src-c6edfe5c180f2234113c64e6c92e3e31920e7c57.zip
FreeBSD-src-c6edfe5c180f2234113c64e6c92e3e31920e7c57.tar.gz
Changes to get rid of ufslk2 hangs when doing read/write to/from
mmap regions that are in the same file as the read/write.
Diffstat (limited to 'sys/gnu')
-rw-r--r--sys/gnu/ext2fs/ext2_ihash.c24
-rw-r--r--sys/gnu/ext2fs/inode.h6
-rw-r--r--sys/gnu/fs/ext2fs/inode.h6
3 files changed, 25 insertions, 11 deletions
diff --git a/sys/gnu/ext2fs/ext2_ihash.c b/sys/gnu/ext2fs/ext2_ihash.c
index ce5b0f8..18ac11c 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 1646792..f0c7297 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 1646792..f0c7297 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
/*
OpenPOWER on IntegriCloud