Skip to contentSkip to conversation

LVM2 ./WHATS_NEW lib/config/config.c

PATCH [email protected] 1 participant 1 message Jul 21, 2011

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac at sourceware.org 2011-07-21 13:23:49

Modified files:
. : WHATS_NEW
lib/config : config.c

Log message:
Compare also file size to detect changed config file

Clvmd detects modifed config file before it takes lv_lock. If the config file is changed rapidly - the change was ignored within a seocnd ranged. This patch adds also compare of file size. So change like some flag for 0 to 1 would pass unnoticed - but it's quick fix for failing test suite.

FIXME: Implement inotify solution.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2042&r2=1.2043
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.100&r2=1.101

WHATS_NEW +1 -0
@@ -1,5 +1,6 @@
 Version 2.02.87 - 
 ===============================
+  Compare also file size to detect changed config file.
 
 Version 2.02.86 - 8th July 2011
 ===============================
lib/config/config.c +3 -1
@@ -62,6 +62,7 @@
 	struct config_tree cft;
 	struct dm_pool *mem;
 	time_t timestamp;
+	off_t st_size;
 	char *filename;
 	int exists;
 	int keep_open;
@@ -309,6 +310,7 @@
 	}
 
 	c->timestamp = info.st_ctime;
+	c->st_size = info.st_size;
 
 	return r;
 }
@@ -352,7 +354,7 @@
 	}
 
 	/* Unchanged? */
-	if (c->timestamp == info.st_ctime)
+	if (c->timestamp == info.st_ctime && c->st_size == info.st_size)
 		return 0;
 
       reload: