1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-23 21:35:29 +03:00

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
This commit is contained in:
Zdenek Kabelac 2011-02-03 01:16:35 +00:00
parent 9e12eb1cf5
commit 3d3f093b8c
3 changed files with 18 additions and 0 deletions

View File

@ -460,6 +460,18 @@ int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, unsigned o
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))

View File

@ -422,3 +422,8 @@ void fs_set_cookie(uint32_t cookie)
{
_fs_cookie = cookie;
}
int fs_has_non_delete_ops(void)
{
return _other_fs_ops(FS_DEL);
}

View File

@ -32,5 +32,6 @@ int fs_rename_lv(struct logical_volume *lv, const char *dev,
/* 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