devfs
[Top] [All Lists]

[PATCH] fix initlog/minilogd deadlock on /dev/log access

To: flepied@xxxxxxxxxxxxxxxx
Subject: [PATCH] fix initlog/minilogd deadlock on /dev/log access
From: "Andrey Borzenkov" <arvidjaar@xxxxxxx>
Date: Tue, 22 Apr 2003 22:33:15 +0400
Cc: quintela@xxxxxxxxxxxxxxxx, cooker@xxxxxxxxxxxxxxxx, devfs@xxxxxxxxxxx
Reply-to: "Andrey Borzenkov" <arvidjaar@xxxxxxx>
Sender: devfs-bounce@xxxxxxxxxxx
[This is crossposted because it was once reported as devfs bug. 
If anybody still remembers that :)] 
 
Some people reported boot hanging somewhere around "Checking 
modules dependencies" or "mounting filesystems". 
 
Minilogd checks for /dev/log ino/Xtime change to detect syslogd 
startup. Unfortunately, connect() on Unix socket modifies atime, 
and initlog does openlog/syslog/closelog for every line. Initlog 
buffers first 8K and starts output ... after the first line minilogd 
believes syslogd has been started and tries now to connect to /dev/log. 
Listening to it at the same time. 
 
I do not claim I fully understand what happens but I suspect attempting 
to connect to itself (because minilogd still continues to listen on 
/dev/log) will deadlock minilogd and next connect from initlog will 
hang waiting to be accepted. 
 
What is really surprising - how can it work at all ... this may 
indicate some sort of races in sockfs as well. 
 
the problem was associated with devfs because with disk-based /dev 
root is usually ro on boot i.e. /dev/log eiter cannot be created at 
all or cannot be modified. 
 
anyway I am pretty sure this patch fixes it because I started to have 
deadlock situation on every second boot. With this patch it boots 
now just fine. 
 
-andrey 

Attachment: minilogd.patch
Description: Text Data

<Prev in Thread] Current Thread [Next in Thread>