[Stgt-devel] disk kicked out of RAID -> tgtd segmentation fault

FUJITA Tomonori fujita.tomonori
Wed Jul 9 10:09:36 CEST 2008


On Tue, 1 Jul 2008 09:34:00 +1000
"Mark Harvey" <markh794 at gmail.com> wrote:

> Hi Tomasz,
> 
> I've also noticed there is only one tgtd process when running it in
> the foreground.
> 
> Running in the foreground has been the only way I've been successful
> in collecting core files in the past.
> 
> I still do not (read: never actually spent time looking) understand
> the why/what differences is between foreground and why there is two
> processes while in background.

We have two tgtd processes to write a log file safely (to avoid
blocking).

Let's suppose that we have only one tgtd process. The process calls
syslog to write a log file. In an out-of-memory situation, syslog()
blocks. It means that the process might sleeps for long time. We can't
perform any SCSI processes so that commands from initiators are likely
to be aborted due to timeout. With '-f' option, tgtd works in this
way.

By default, we have two processes. They use shared memory. The main
process performs everything except for logging. The process writes a
log message to the shared memory instead of calling syslog(). Another
(logging) process calls syslog to write the message in the shared
memory to a log file.  In an out-of-memory situation, the logging
process might sleep for long time but the main process doesn't. If the
shared memory is full, a log message is lost but the main process
always works for initiators.



More information about the stgt mailing list