On Thu, Jan 18, 2018 at 06:07:39AM -0800, Matthew Wilcox wrote: > On Thu, Jan 18, 2018 at 02:38:39PM +0100, Jan H. Schönherr wrote: > > The function follow_pte_pmd() can theoretically return after having > > acquired a PMD lock, even when DAX was not compiled with > > CONFIG_FS_DAX_PMD. > > I don't think it can. How would a PMD entry get into a DAX VMA if we > compiled the kernel without CONFIG_FS_DAX_PMD? How about this patch instead? Should shut up sparse nicely. diff --git a/fs/dax.c b/fs/dax.c index 78b72c48374e..fea1b64d111b 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -586,6 +586,12 @@ pgoff_address(pgoff_t pgoff, struct vm_area_struct *vma) return address; } +#ifdef CONFIG_FS_DAX_PMD +#define dax_pmd(pmdp) pmdp +#else +#define dax_pmd(pmdp) 0 +#endif + /* Walk all mappings of a given index of a file and writeprotect them */ static void dax_mapping_entry_mkclean(struct address_space *mapping, pgoff_t index, unsigned long pfn) @@ -621,8 +627,7 @@ static void dax_mapping_entry_mkclean(struct address_space *mapping, * * See Documentation/vm/mmu_notifier.txt */ - if (pmdp) { -#ifdef CONFIG_FS_DAX_PMD + if (dax_pmd(pmdp)) { pmd_t pmd; if (pfn != pmd_pfn(*pmdp)) @@ -638,7 +643,6 @@ static void dax_mapping_entry_mkclean(struct address_space *mapping, set_pmd_at(vma->vm_mm, address, pmdp, pmd); unlock_pmd: spin_unlock(ptl); -#endif } else { if (pfn != pte_pfn(*ptep)) goto unlock_pte;