[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

iohelp handle_io_release_conch doesn't lock shared page

From: Marcus Brinkmann
Subject: iohelp handle_io_release_conch doesn't lock shared page
Date: Sat, 11 May 2002 04:02:30 +0200
User-agent: Mutt/1.3.28i


I think I found the following missing locking in libiohelp:

2002-05-11  Marcus Brinkmann  <marcus@gnu.org>

        * handle_io_release_conch.c (iohelp_handle_io_release_conch):
        New variable USER_SH.  Hold USER_SH->lock while checking conch

See the below patch.  However, this does not seem to be enough to get conchs
working with exec.  Uncommenting the io_map_cntl in exec/exec.c leads to a
dead-lock when booting a second Hurd.  exec hangs in io_get_conch, while
ext2fs hangs in condition_wait waiting for the conch to be released.  This
happens when trying to start proc, or, if the -d option is given to boot,
when trying to start console-run (in this latter case, proc and auth start
up fine, which seems to indicate that there is some sort of race involved).

The code however looks fine as far as I can tell.  It just seems that the
exec server and the ext2fs have a different idea on what the shared page
looks like, despite the spin lock properly taken.  While exec thinks that
USER_HAS_NOT_CONCH is the status, ext2fs thinks that USER_RELEASE_CONCH is
the status (which actually might be a prior USER_HAS_CONCH).  Can this be a
default pager/mach vm bug, too?

It seems that the shared I/O code is not really tested and a bit dated. 
Thomas, do you remember any unresolved issues about it?


Index: handle_io_release_conch.c
RCS file: /cvsroot/hurd/hurd/libiohelp/handle_io_release_conch.c,v
retrieving revision 1.7
diff -u -p -r1.7 handle_io_release_conch.c
--- handle_io_release_conch.c   6 May 1996 20:31:03 -0000       1.7
+++ handle_io_release_conch.c   11 May 2002 01:47:25 -0000
@@ -23,13 +23,16 @@
 iohelp_handle_io_release_conch (struct conch *c, void *user)
+  struct shared_io *user_sh = c->holder_shared_page;
+  spin_lock (&user_sh->lock);
   if (c->holder_shared_page->conch_status != USER_HAS_NOT_CONCH)
       c->holder_shared_page->conch_status = USER_HAS_NOT_CONCH;
       iohelp_fetch_shared_data (c->holder);
+  spin_unlock (&user_sh->lock);
   if (c->holder == user)
       c->holder = 0;

`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann              GNU    http://www.gnu.org    marcus@gnu.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]