]> sourceware.org Git - lvm2.git/commitdiff
Synchronize with udev for lv_info
authorZdenek Kabelac <zkabelac@redhat.com>
Thu, 3 Feb 2011 01:16:35 +0000 (01:16 +0000)
committerZdenek Kabelac <zkabelac@redhat.com>
Thu, 3 Feb 2011 01:16:35 +0000 (01:16 +0000)
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

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

index 3670ea4a5a89b76bfa6fc0a095fad9cfcdd31de5..dd40acc060706885308449c10ef2dd31b753deb9 100644 (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))
index ae94763ea1dc434c399c26a761ec66bd852b7a02..373d1599dc452be3656672725eae9f888ce5628a 100644 (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);
+}
index 17ecedf5f1460396c3276547c2e865e99839a151..43e2846a8b31b7c49dc5edb7c00625cff098c17f 100644 (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
This page took 0.041173 seconds and 5 git commands to generate.