All of lore.kernel.org
 help / color / mirror / Atom feed
From: prajnoha@sourceware.org <prajnoha@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2 ./WHATS_NEW_DM libdm/libdm-common.c
Date: 3 Aug 2010 07:56:04 -0000	[thread overview]
Message-ID: <20100803075604.1030.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	prajnoha at sourceware.org	2010-08-03 07:56:04

Modified files:
	.              : WHATS_NEW_DM 
	libdm          : libdm-common.c 

Log message:
	Add check for kernel semaphore support and disable udev_sync if not available.
	
	udev_sync feature requires semaphores (part of System V IPC) to be configured
	in kernel (CONFIG_SYSVIPC). Check whether it is supported and if not, give
	a warning message and disable udev synchronisation code automatically to
	avoid any further error states and associated problems.
	
	One should use the kernel with System V IPC support enabled or libdevmapper
	with udev_sync feature disabled.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.400&r2=1.401
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.97&r2=1.98

--- LVM2/WHATS_NEW_DM	2010/07/28 21:58:08	1.400
+++ LVM2/WHATS_NEW_DM	2010/08/03 07:56:03	1.401
@@ -1,5 +1,6 @@
 Version 1.02.54 - 
 ================================
+  Add check for kernel semaphore support and disable udev_sync if not available.
 
 Version 1.02.53 - 28th July 2010
 ================================
--- LVM2/libdm/libdm-common.c	2010/07/09 15:34:47	1.97
+++ LVM2/libdm/libdm-common.c	2010/08/03 07:56:03	1.98
@@ -60,6 +60,7 @@
 static int _verbose = 0;
 
 #ifdef UDEV_SYNC_SUPPORT
+static int _semaphore_supported = -1;
 static int _udev_running = -1;
 static int _sync_with_udev = 1;
 static int _udev_checking = 1;
@@ -929,6 +930,23 @@
 
 #else		/* UDEV_SYNC_SUPPORT */
 
+static int _check_semaphore_is_supported()
+{
+	int maxid;
+	union semun arg;
+	struct seminfo seminfo;
+
+	arg.__buf = &seminfo;
+	maxid = semctl(0, 0, SEM_INFO, arg);
+
+	if (maxid < 0) {
+		log_warn("Kernel not configured for semaphores (System V IPC). "
+			 "Not using udev synchronisation code.");
+		return 0;
+	}
+
+	return 1;
+}
 
 static int _check_udev_is_running(void)
 {
@@ -958,20 +976,27 @@
 	return 0;
 }
 
-void dm_udev_set_sync_support(int sync_with_udev)
+static void _check_udev_sync_requirements_once()
 {
+	if (_semaphore_supported < 0)
+		_semaphore_supported = _check_semaphore_is_supported();
+
 	if (_udev_running < 0)
 		_udev_running = _check_udev_is_running();
+}
 
+void dm_udev_set_sync_support(int sync_with_udev)
+{
+	_check_udev_sync_requirements_once();
 	_sync_with_udev = sync_with_udev;
 }
 
 int dm_udev_get_sync_support(void)
 {
-	if (_udev_running < 0)
-		_udev_running = _check_udev_is_running();
+	_check_udev_sync_requirements_once();
 
-	return dm_cookie_supported() && _udev_running && _sync_with_udev;
+	return _semaphore_supported && dm_cookie_supported() &&
+		_udev_running && _sync_with_udev;
 }
 
 void dm_udev_set_checking(int checking)



             reply	other threads:[~2010-08-03  7:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-03  7:56 prajnoha [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-03-05 12:45 LVM2 ./WHATS_NEW_DM libdm/libdm-common.c prajnoha
2012-02-28  8:36 prajnoha
2012-02-13 10:49 zkabelac
2012-02-08 11:07 zkabelac
2011-03-30 12:14 zkabelac
2010-05-27 15:02 prajnoha
2009-09-25 18:08 agk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100803075604.1030.qmail@sourceware.org \
    --to=prajnoha@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.