dax: New fault locking
[sfrench/cifs-2.6.git] / mm / filemap.c
index dfe55c2cfb34a94660f43f5294cfdf0ce3bf6f5c..7b9a4b180cae2a8ae3c4d24e17a27db03e1f91fd 100644 (file)
@@ -160,13 +160,15 @@ static void page_cache_tree_delete(struct address_space *mapping,
                        return;
 
        /*
-        * Track node that only contains shadow entries.
+        * Track node that only contains shadow entries. DAX mappings contain
+        * no shadow entries and may contain other exceptional entries so skip
+        * those.
         *
         * Avoid acquiring the list_lru lock if already tracked.  The
         * list_empty() test is safe as node->private_list is
         * protected by mapping->tree_lock.
         */
-       if (!workingset_node_pages(node) &&
+       if (!dax_mapping(mapping) && !workingset_node_pages(node) &&
            list_empty(&node->private_list)) {
                node->private_data = mapping;
                list_lru_add(&workingset_shadow_nodes, &node->private_list);
@@ -611,6 +613,9 @@ static int page_cache_tree_insert(struct address_space *mapping,
                        /* DAX accounts exceptional entries as normal pages */
                        if (node)
                                workingset_node_pages_dec(node);
+                       /* Wakeup waiters for exceptional entry lock */
+                       dax_wake_mapping_entry_waiter(mapping, page->index,
+                                                     false);
                }
        }
        radix_tree_replace_slot(slot, page);