History

Merge tag 'libnvdimm-fixes-4.19-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm

Dan writes: "libnvdimm/dax 4.19-rc8 * Fix a livelock in dax_layout_busy_page() present since v4.18. The lockup triggers when truncating an actively mapped huge page out of a mapping pinned for direct-I/O. * Fix mprotect() clobbers of _PAGE_DEVMAP. Broken since v4.5 mprotect() clears this flag that is needed to communicate the liveness of device pages to the get_user_pages() path." * tag 'libnvdimm-fixes-4.19-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: mm: Preserve _PAGE_DEVMAP across mprotect() calls filesystem-dax: Fix dax_layout_busy_page() livelock

Greg Kroah-Hartman committed 8 years ago

Commit 3a272032 parents a24a0eb 4628a643 files · +14 −5Browse files

Unified · Split

3 files
  1. arch/powerpc/include/asm/book3s/64/pgtable.h +2 −2
  2. arch/x86/include/asm/pgtable_types.h +1 −1
  3. fs/dax.c +11 −2
arch/powerpc/include/asm/book3s/64/pgtable.h+2−2
@@ -114,7 +114,7 @@ · 113 unmodified lines
114114 */
115115 #define _HPAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \
116116 _PAGE_ACCESSED | H_PAGE_THP_HUGE | _PAGE_PTE | \
117− _PAGE_SOFT_DIRTY)
117+ _PAGE_SOFT_DIRTY | _PAGE_DEVMAP)
118118 /*
119119 * user access blocked by key
120120 */
@@ -132,7 +132,7 @@ · 11 unmodified lines
132132 */
133133 #define _PAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \
134134 _PAGE_ACCESSED | _PAGE_SPECIAL | _PAGE_PTE | \
135− _PAGE_SOFT_DIRTY)
135+ _PAGE_SOFT_DIRTY | _PAGE_DEVMAP)
136136
137137 #define H_PTE_PKEY (H_PTE_PKEY_BIT0 | H_PTE_PKEY_BIT1 | H_PTE_PKEY_BIT2 | \
138138 H_PTE_PKEY_BIT3 | H_PTE_PKEY_BIT4)
arch/x86/include/asm/pgtable_types.h+1−1
@@ -124,7 +124,7 @@ · 123 unmodified lines
124124 */
125125 #define _PAGE_CHG_MASK (PTE_PFN_MASK | _PAGE_PCD | _PAGE_PWT | \
126126 _PAGE_SPECIAL | _PAGE_ACCESSED | _PAGE_DIRTY | \
127− _PAGE_SOFT_DIRTY)
127+ _PAGE_SOFT_DIRTY | _PAGE_DEVMAP)
128128 #define _HPAGE_CHG_MASK (_PAGE_CHG_MASK | _PAGE_PSE)
129129
130130 /*
fs/dax.c+11−2
@@ -666,6 +666,8 @@ struct page *dax_layout_busy_page(struct address_space *mapping) · 665 unmodified lines
666666 while (index < end && pagevec_lookup_entries(&pvec, mapping, index,
667667 min(end - index, (pgoff_t)PAGEVEC_SIZE),
668668 indices)) {
669+ pgoff_t nr_pages = 1;
670+
669671 for (i = 0; i < pagevec_count(&pvec); i++) {
670672 struct page *pvec_ent = pvec.pages[i];
671673 void *entry;
@@ -680,8 +682,15 @@ struct page *dax_layout_busy_page(struct address_space *mapping) · 8 unmodified lines
680682
681683 xa_lock_irq(&mapping->i_pages);
682684 entry = get_unlocked_mapping_entry(mapping, index, NULL);
683− if (entry)
685+ if (entry) {
684686 page = dax_busy_page(entry);
687+ /*
688+ * Account for multi-order entries at
689+ * the end of the pagevec.
690+ */
691+ if (i + 1 >= pagevec_count(&pvec))
692+ nr_pages = 1UL << dax_radix_order(entry);
693+ }
685694 put_unlocked_mapping_entry(mapping, index, entry);
686695 xa_unlock_irq(&mapping->i_pages);
687696 if (page)
@@ -696,7 +705,7 @@ struct page *dax_layout_busy_page(struct address_space *mapping) · 8 unmodified lines
696705 */
697706 pagevec_remove_exceptionals(&pvec);
698707 pagevec_release(&pvec);
699− index++;
708+ index += nr_pages;
700709
701710 if (page)
702711 break;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t