aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-09-19 22:13:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-19 22:13:03 -0400
commit2673ee565f10e0f2fdcf61f7a715e6b4ac2497dc (patch)
tree891d96ee0295b8567dd49b25e384fe2e5886fe0c
parent133bb59585140747fd3938002670cb395f40dc76 (diff)
parentae4f976968896f8f41b3a7aa21be6146492211e5 (diff)
Merge branch 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull libnvdimm fixes from Dan Williams: - a boot regression (since v4.2) fix for some ARM configurations from Tyler - regression (since v4.1) fixes for mkfs.xfs on a DAX enabled device from Jeff. These are tagged for -stable. - a pair of locking fixes from Axel that are hidden from lockdep since they involve device_lock(). The "btt" one is tagged for -stable, the other only applies to the new "pfn" mechanism in v4.3. - a fix for the pmem ->rw_page() path to use wmb_pmem() from Ross. * 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: mm: fix type cast in __pfn_to_phys() pmem: add proper fencing to pmem_rw_page() libnvdimm: pfn_devs: Fix locking in namespace_store libnvdimm: btt_devs: Fix locking in namespace_store blockdev: don't set S_DAX for misaligned partitions dax: fix O_DIRECT I/O to the last block of a blockdev
-rw-r--r--drivers/nvdimm/btt_devs.c4
-rw-r--r--drivers/nvdimm/pfn_devs.c4
-rw-r--r--drivers/nvdimm/pmem.c2
-rw-r--r--fs/block_dev.c7
-rw-r--r--fs/dax.c3
-rw-r--r--include/asm-generic/memory_model.h2
6 files changed, 16 insertions, 6 deletions
diff --git a/drivers/nvdimm/btt_devs.c b/drivers/nvdimm/btt_devs.c
index 59ad54a63d9f..cb477518dd0e 100644
--- a/drivers/nvdimm/btt_devs.c
+++ b/drivers/nvdimm/btt_devs.c
@@ -128,13 +128,13 @@ static ssize_t namespace_store(struct device *dev,
128 struct nd_btt *nd_btt = to_nd_btt(dev); 128 struct nd_btt *nd_btt = to_nd_btt(dev);
129 ssize_t rc; 129 ssize_t rc;
130 130
131 nvdimm_bus_lock(dev);
132 device_lock(dev); 131 device_lock(dev);
132 nvdimm_bus_lock(dev);
133 rc = nd_namespace_store(dev, &nd_btt->ndns, buf, len); 133 rc = nd_namespace_store(dev, &nd_btt->ndns, buf, len);
134 dev_dbg(dev, "%s: result: %zd wrote: %s%s", __func__, 134 dev_dbg(dev, "%s: result: %zd wrote: %s%s", __func__,
135 rc, buf, buf[len - 1] == '\n' ? "" : "\n"); 135 rc, buf, buf[len - 1] == '\n' ? "" : "\n");
136 device_unlock(dev);
137 nvdimm_bus_unlock(dev); 136 nvdimm_bus_unlock(dev);
137 device_unlock(dev);
138 138
139 return rc; 139 return rc;
140} 140}
diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c
index 3fd7d0d81a47..71805a1aa0f3 100644
--- a/drivers/nvdimm/pfn_devs.c
+++ b/drivers/nvdimm/pfn_devs.c
@@ -148,13 +148,13 @@ static ssize_t namespace_store(struct device *dev,
148 struct nd_pfn *nd_pfn = to_nd_pfn(dev); 148 struct nd_pfn *nd_pfn = to_nd_pfn(dev);
149 ssize_t rc; 149 ssize_t rc;
150 150
151 nvdimm_bus_lock(dev);
152 device_lock(dev); 151 device_lock(dev);
152 nvdimm_bus_lock(dev);
153 rc = nd_namespace_store(dev, &nd_pfn->ndns, buf, len); 153 rc = nd_namespace_store(dev, &nd_pfn->ndns, buf, len);
154 dev_dbg(dev, "%s: result: %zd wrote: %s%s", __func__, 154 dev_dbg(dev, "%s: result: %zd wrote: %s%s", __func__,
155 rc, buf, buf[len - 1] == '\n' ? "" : "\n"); 155 rc, buf, buf[len - 1] == '\n' ? "" : "\n");
156 device_unlock(dev);
157 nvdimm_bus_unlock(dev); 156 nvdimm_bus_unlock(dev);
157 device_unlock(dev);
158 158
159 return rc; 159 return rc;
160} 160}
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index b9525385c0dc..0ba6a978f227 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -92,6 +92,8 @@ static int pmem_rw_page(struct block_device *bdev, sector_t sector,
92 struct pmem_device *pmem = bdev->bd_disk->private_data; 92 struct pmem_device *pmem = bdev->bd_disk->private_data;
93 93
94 pmem_do_bvec(pmem, page, PAGE_CACHE_SIZE, 0, rw, sector); 94 pmem_do_bvec(pmem, page, PAGE_CACHE_SIZE, 0, rw, sector);
95 if (rw & WRITE)
96 wmb_pmem();
95 page_endio(page, rw & WRITE, 0); 97 page_endio(page, rw & WRITE, 0);
96 98
97 return 0; 99 return 0;
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 22ea424ee741..073bb57adab1 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1242,6 +1242,13 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
1242 goto out_clear; 1242 goto out_clear;
1243 } 1243 }
1244 bd_set_size(bdev, (loff_t)bdev->bd_part->nr_sects << 9); 1244 bd_set_size(bdev, (loff_t)bdev->bd_part->nr_sects << 9);
1245 /*
1246 * If the partition is not aligned on a page
1247 * boundary, we can't do dax I/O to it.
1248 */
1249 if ((bdev->bd_part->start_sect % (PAGE_SIZE / 512)) ||
1250 (bdev->bd_part->nr_sects % (PAGE_SIZE / 512)))
1251 bdev->bd_inode->i_flags &= ~S_DAX;
1245 } 1252 }
1246 } else { 1253 } else {
1247 if (bdev->bd_contains == bdev) { 1254 if (bdev->bd_contains == bdev) {
diff --git a/fs/dax.c b/fs/dax.c
index 93bf2f990ace..7ae6df7ea1d2 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -119,7 +119,8 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter,
119 size_t len; 119 size_t len;
120 if (pos == max) { 120 if (pos == max) {
121 unsigned blkbits = inode->i_blkbits; 121 unsigned blkbits = inode->i_blkbits;
122 sector_t block = pos >> blkbits; 122 long page = pos >> PAGE_SHIFT;
123 sector_t block = page << (PAGE_SHIFT - blkbits);
123 unsigned first = pos - (block << blkbits); 124 unsigned first = pos - (block << blkbits);
124 long size; 125 long size;
125 126
diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_model.h
index f20f407ce45d..4b4b056a6eb0 100644
--- a/include/asm-generic/memory_model.h
+++ b/include/asm-generic/memory_model.h
@@ -73,7 +73,7 @@
73 * Convert a physical address to a Page Frame Number and back 73 * Convert a physical address to a Page Frame Number and back
74 */ 74 */
75#define __phys_to_pfn(paddr) ((unsigned long)((paddr) >> PAGE_SHIFT)) 75#define __phys_to_pfn(paddr) ((unsigned long)((paddr) >> PAGE_SHIFT))
76#define __pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT) 76#define __pfn_to_phys(pfn) PFN_PHYS(pfn)
77 77
78#define page_to_pfn __page_to_pfn 78#define page_to_pfn __page_to_pfn
79#define pfn_to_page __pfn_to_page 79#define pfn_to_page __pfn_to_page