[Cosmic][PATCH 1/3] dax: dax_layout_busy_page() warn on !exceptional

Joseph Salisbury joseph.salisbury at canonical.com
Mon Sep 10 18:47:43 UTC 2018


From: Ross Zwisler <ross.zwisler at linux.intel.com>

BugLink: https://bugs.launchpad.net/bugs/1787089

Inodes using DAX should only ever have exceptional entries in their page
caches.  Make this clear by warning if the iteration in
dax_layout_busy_page() ever sees a non-exceptional entry, and by adding a
comment for the pagevec_release() call which only deals with struct page
pointers.

Signed-off-by: Ross Zwisler <ross.zwisler at linux.intel.com>
Signed-off-by: Theodore Ts'o <tytso at mit.edu>
Reviewed-by: Jan Kara <jack at suse.cz>
(cherry picked from commit cdbf8897cb09b7baf2b8a7e78051a35a872b01d5)
Signed-off-by: Joseph Salisbury <joseph.salisbury at canonical.com>
---
 fs/dax.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/dax.c b/fs/dax.c
index 57ec272..48d3eb9 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -673,7 +673,8 @@ struct page *dax_layout_busy_page(struct address_space *mapping)
 			if (index >= end)
 				break;
 
-			if (!radix_tree_exceptional_entry(pvec_ent))
+			if (WARN_ON_ONCE(
+			     !radix_tree_exceptional_entry(pvec_ent)))
 				continue;
 
 			xa_lock_irq(&mapping->i_pages);
@@ -685,6 +686,13 @@ struct page *dax_layout_busy_page(struct address_space *mapping)
 			if (page)
 				break;
 		}
+
+		/*
+		 * We don't expect normal struct page entries to exist in our
+		 * tree, but we keep these pagevec calls so that this code is
+		 * consistent with the common pattern for handling pagevecs
+		 * throughout the kernel.
+		 */
 		pagevec_remove_exceptionals(&pvec);
 		pagevec_release(&pvec);
 		index++;
-- 
2.7.4





More information about the kernel-team mailing list