Skip to contentSkip to conversation

LVM2/lib/activate activate.c fs.c fs.h

PATCH [email protected] 1 participant 1 message Feb 3, 2011

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac at sourceware.org 2011-02-03 01:16:35

Modified files:
lib/activate : activate.c fs.c fs.h

Log message:
Synchronize with udev for lv_info

In case the open_count is requested via lv_info - check if there are any udev operations in-progress - and wait for them before checking for lv_info

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.186&r2=1.187
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/fs.c.diff?cvsroot=lvm2&r1=1.56&r2=1.57
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/fs.h.diff?cvsroot=lvm2&r1=1.16&r2=1.17

lib/activate/activate.c +12 -0
@@ -460,6 +460,18 @@
 
 	if (!activation())
 		return 0;
+	/*
+	 * If open_count info is requested and we have to be sure our own udev
+	 * transactions are finished
+	 * For non-clustered locking type we are only interested for non-delete operation
+	 * in progress - as only those could lead to opened files
+	 */
+	if (with_open_count) {
+		if (locking_is_clustered())
+			sync_local_dev_names(cmd); /* Wait to have udev in sync */
+		else if (fs_has_non_delete_ops())
+			fs_unlock(); /* For non clustered - wait if there are non-delete ops */
+	}
 
 	if (!dev_manager_info(lv->vg->cmd->mem, lv, origin_only ? "real" : NULL, with_open_count,
 			      with_read_ahead, &dminfo, &info->read_ahead))
lib/activate/fs.c +5 -0
@@ -422,3 +422,8 @@
 {
 	_fs_cookie = cookie;
 }
+
+int fs_has_non_delete_ops(void)
+{
+	return _other_fs_ops(FS_DEL);
+}
lib/activate/fs.h +1 -0
@@ -32,5 +32,6 @@
 /* void fs_unlock(void);  moved to activate.h */
 uint32_t fs_get_cookie(void);
 void fs_set_cookie(uint32_t cookie);
+int fs_has_non_delete_ops(void);
 
 #endif