File open-iscsi-error-check-in-db-lock-creation of Package open-iscsi

commit 37f18edf5c61193434651fc61f5cfe5107f43c6d
Author: Hans de Goede <>
Date:   Mon Sep 29 13:11:58 2008 +0200

    PATCH: add error checking to iscsi discovery db lock creation
    Hi Make,
    I've been bitten numerous times now by iscsiadm hanging when run as normal user
    (it spins trying to create the lock, which will never succeed as it simple
      misses the rights todo so).
    I plan on including the attached patch in the new rawhide / F-10 package with
    the new initscripts I'm working on. Please scream loudly if you object against
    this patch.
    If we go ahead with this patch I assume you will take care of getting it upstream.

diff --git a/usr/idbm.c b/usr/idbm.c
index 0cb3c44..a7a1072 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -850,6 +850,14 @@ int idbm_lock(void)
 		if (ret == 0)
+		if (errno != EEXIST) {
+			log_error("Could not lock discovery DB: %s: %s",
+					LOCK_WRITE_FILE, strerror(errno));
+			log_error("Maybe you are not root?");
+			exit(-1);
+		} else if (i == 0)
+			log_debug(2, "Waiting for discovery DB lock");