Merge remote-tracking branch 'lsk/v4.4/topic/mm-kaslr' into linux-linaro-lsk-v4.4
[firefly-linux-kernel-4.4.55.git] / drivers / md / dm-thin-metadata.c
index 67871e74c82bc9fc0ce831dad66c920fc368efbc..911ada64336407fe15f8b5d6fc2df026cf1649cc 100644 (file)
@@ -1206,6 +1206,12 @@ static int __reserve_metadata_snap(struct dm_pool_metadata *pmd)
        struct dm_block *copy, *sblock;
        dm_block_t held_root;
 
+       /*
+        * We commit to ensure the btree roots which we increment in a
+        * moment are up to date.
+        */
+       __commit_transaction(pmd);
+
        /*
         * Copy the superblock.
         */
@@ -1937,5 +1943,8 @@ bool dm_pool_metadata_needs_check(struct dm_pool_metadata *pmd)
 
 void dm_pool_issue_prefetches(struct dm_pool_metadata *pmd)
 {
-       dm_tm_issue_prefetches(pmd->tm);
+       down_read(&pmd->root_lock);
+       if (!pmd->fail_io)
+               dm_tm_issue_prefetches(pmd->tm);
+       up_read(&pmd->root_lock);
 }