Skip to content

Commit a385231

Browse files
committed
erge tag 'libnvdimm-fixes-4.19-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Dan writes: "libnvdimm/dax for 4.19-rc6 * (2) fixes for the dax error handling updates that were merged for v4.19-rc1. My mails to Al have been bouncing recently, so I do not have his ack but the uaccess change is of the trivial / obviously correct variety. The address_space_operations fixes a regression. * A filesystem-dax fix to correct the zero page lookup to be compatible with non-x86 (mips and s390) architectures." * tag 'libnvdimm-fixes-4.19-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: device-dax: Add missing address_space_operations uaccess: Fix is_source param for check_copy_size() in copy_to_iter_mcsafe() filesystem-dax: Fix use of zero page
2 parents 846e8dd + 41c9b1b commit a385231

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

drivers/dax/device.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,11 @@ static unsigned long dax_get_unmapped_area(struct file *filp,
535535
return current->mm->get_unmapped_area(filp, addr, len, pgoff, flags);
536536
}
537537

538+
static const struct address_space_operations dev_dax_aops = {
539+
.set_page_dirty = noop_set_page_dirty,
540+
.invalidatepage = noop_invalidatepage,
541+
};
542+
538543
static int dax_open(struct inode *inode, struct file *filp)
539544
{
540545
struct dax_device *dax_dev = inode_dax(inode);
@@ -544,6 +549,7 @@ static int dax_open(struct inode *inode, struct file *filp)
544549
dev_dbg(&dev_dax->dev, "trace\n");
545550
inode->i_mapping = __dax_inode->i_mapping;
546551
inode->i_mapping->host = __dax_inode;
552+
inode->i_mapping->a_ops = &dev_dax_aops;
547553
filp->f_mapping = inode->i_mapping;
548554
filp->f_wb_err = filemap_sample_wb_err(filp->f_mapping);
549555
filp->private_data = dev_dax;

fs/dax.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,21 +1120,12 @@ static vm_fault_t dax_load_hole(struct address_space *mapping, void *entry,
11201120
{
11211121
struct inode *inode = mapping->host;
11221122
unsigned long vaddr = vmf->address;
1123-
vm_fault_t ret = VM_FAULT_NOPAGE;
1124-
struct page *zero_page;
1125-
pfn_t pfn;
1126-
1127-
zero_page = ZERO_PAGE(0);
1128-
if (unlikely(!zero_page)) {
1129-
ret = VM_FAULT_OOM;
1130-
goto out;
1131-
}
1123+
pfn_t pfn = pfn_to_pfn_t(my_zero_pfn(vaddr));
1124+
vm_fault_t ret;
11321125

1133-
pfn = page_to_pfn_t(zero_page);
11341126
dax_insert_mapping_entry(mapping, vmf, entry, pfn, RADIX_DAX_ZERO_PAGE,
11351127
false);
11361128
ret = vmf_insert_mixed(vmf->vma, vaddr, pfn);
1137-
out:
11381129
trace_dax_load_hole(inode, vmf, ret);
11391130
return ret;
11401131
}

include/linux/uio.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ size_t copy_from_iter_flushcache(void *addr, size_t bytes, struct iov_iter *i)
172172
static __always_inline __must_check
173173
size_t copy_to_iter_mcsafe(void *addr, size_t bytes, struct iov_iter *i)
174174
{
175-
if (unlikely(!check_copy_size(addr, bytes, false)))
175+
if (unlikely(!check_copy_size(addr, bytes, true)))
176176
return 0;
177177
else
178178
return _copy_to_iter_mcsafe(addr, bytes, i);

0 commit comments

Comments
 (0)