Bug 360 - filesystem deadlock trivial to produce
Summary: filesystem deadlock trivial to produce
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 1995-04-24 22:00 UTC by Curt Mayer
Modified: 1995-04-24 22:00 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Curt Mayer 1995-04-24 22:00:01 UTC
	the filesystem deadlocks when installing a file to itself.
	a ktrace shows a strange sequence:

   450 install  CALL  stat(0xefbfda0f,0xefbfd87c)
   450 install  NAMI  "/var/tmp/xx"
   450 install  RET   stat 0
   450 install  CALL  stat(0xefbfda07,0xefbfd7ec)
   450 install  NAMI  "termcap"
   450 install  RET   stat 0
   450 install  CALL  stat(0x4414,0xefbfd78c)
   450 install  NAMI  "/var/tmp/xx/termcap"
   450 install  RET   stat 0
   450 install  CALL  unlink(0x4414)
   450 install  NAMI  "/var/tmp/xx/termcap"
   450 install  RET   unlink 0
   450 install  CALL  open(0x4414,0x601,0x180)
   450 install  NAMI  "/var/tmp/xx/termcap"
   450 install  RET   open 3
   450 install  CALL  open(0xefbfda07,0,0)
   450 install  NAMI  "termcap"
   450 install  RET   open 4
   450 install  CALL  mmap(0,0x2c48e,0x1,0,0x4,0,0,0)
   450 install  RET   mmap 134807552/0x8090000
   450 install  CALL  write(0x3,0x8090000,0x2c48e)

	at this point, deadlock with ps -l reporting ufslk2

Fix: 

don't install a file to itself.
How-To-Repeat: 
	cd /tmp
	cp /etc/termcap .
	install -c -m 0644 termcap /tmp
	>lockup<
Comment 1 davidg freebsd_committer freebsd_triage 1995-05-07 10:17:22 UTC
State Changed
From-To: open->closed

The bug was caused by a deadlock between the VM system and the 
buffer I/O system trying to acquire the same lock. Fixed in 
rev 1.21/1.22 of ufs_lock.c.