On Tue, Sep 27, 2016 at 06:08:23PM +0200, Jan Kara wrote: > Currently PTE gets updated in wp_pfn_shared() after dax_pfn_mkwrite() > has released corresponding radix tree entry lock. When we want to > writeprotect PTE on cache flush, we need PTE modification to happen > under radix tree entry lock to ensure consisten updates of PTE and radix consistent > tree (standard faults use page lock to ensure this consistency). So move > update of PTE bit into dax_pfn_mkwrite(). > > Signed-off-by: Jan Kara <jack@xxxxxxx> > --- > fs/dax.c | 22 ++++++++++++++++------ > mm/memory.c | 2 +- > 2 files changed, 17 insertions(+), 7 deletions(-) > > diff --git a/fs/dax.c b/fs/dax.c > index c6cadf8413a3..a2d3781c9f4e 100644 > --- a/fs/dax.c > +++ b/fs/dax.c > @@ -1163,17 +1163,27 @@ int dax_pfn_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) > { > struct file *file = vma->vm_file; > struct address_space *mapping = file->f_mapping; > - void *entry; > + void *entry, **slot; > pgoff_t index = vmf->pgoff; > > spin_lock_irq(&mapping->tree_lock); > - entry = get_unlocked_mapping_entry(mapping, index, NULL); > - if (!entry || !radix_tree_exceptional_entry(entry)) > - goto out; > + entry = get_unlocked_mapping_entry(mapping, index, &slot); > + if (!entry || !radix_tree_exceptional_entry(entry)) { > + if (entry) > + put_unlocked_mapping_entry(mapping, index, entry); I don't think you need this call to put_unlocked_mapping_entry(). If we get in here we know that 'entry' is a page cache page, in which case put_unlocked_mapping_entry() will just return without doing any work. With that nit & the spelling error above: Reviewed-by: Ross Zwisler <ross.zwisler@xxxxxxxxxxxxxxx> -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html