1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

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.
This commit is contained in:
Zdenek Kabelac 2011-07-21 13:23:48 +00:00
parent c2ca1a707a
commit 830df40482
2 changed files with 4 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.87 -
===============================
Compare also file size to detect changed config file.
Version 2.02.86 - 8th July 2011
===============================

View File

@ -62,6 +62,7 @@ struct cs {
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 @@ int read_config_file(struct config_tree *cft)
}
c->timestamp = info.st_ctime;
c->st_size = info.st_size;
return r;
}
@ -352,7 +354,7 @@ int config_file_changed(struct config_tree *cft)
}
/* Unchanged? */
if (c->timestamp == info.st_ctime)
if (c->timestamp == info.st_ctime && c->st_size == info.st_size)
return 0;
reload: