Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull libnvdimm fixes from Dan Williams:
"A handful of fixes to address a string of mistakes in the mechanism
for device-mapper to determine if its component devices are dax
capable.

- Fix an original bug in device-mapper table reference counting when
interrogating dax capability in the component device. This bug was
hidden by the following bug.

- Fix device-mapper to use the proper helper (dax_supported() instead
of the leaf helper generic_fsdax_supported()) to determine dax
operation of a stacked block device configuration. The original
implementation is only valid for one level of dax-capable block
device stacking. This bug was discovered while fixing the below
regression.

- Fix an infinite recursion regression introduced by broken attempts
to quiet the generic_fsdax_supported() path and make it bail out
before logging "dax capability not found" errors"

* tag 'libnvdimm-fixes-5.9-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
dax: Fix stack overflow when mounting fsdax pmem device
dm: Call proper helper to determine dax support
dm/dax: Fix table reference counts

+40 -13
+10 -6
drivers/dax/super.c
··· 85 85 return false; 86 86 } 87 87 88 + if (!dax_dev) { 89 + pr_debug("%s: error: dax unsupported by block device\n", 90 + bdevname(bdev, buf)); 91 + return false; 92 + } 93 + 88 94 err = bdev_dax_pgoff(bdev, start, PAGE_SIZE, &pgoff); 89 95 if (err) { 90 96 pr_info("%s: error: unaligned partition for dax\n", ··· 102 96 err = bdev_dax_pgoff(bdev, last_page, PAGE_SIZE, &pgoff_end); 103 97 if (err) { 104 98 pr_info("%s: error: unaligned partition for dax\n", 105 - bdevname(bdev, buf)); 106 - return false; 107 - } 108 - 109 - if (!dax_dev || !bdev_dax_supported(bdev, blocksize)) { 110 - pr_debug("%s: error: dax unsupported by block device\n", 111 99 bdevname(bdev, buf)); 112 100 return false; 113 101 } ··· 325 325 bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev, 326 326 int blocksize, sector_t start, sector_t len) 327 327 { 328 + if (!dax_dev) 329 + return false; 330 + 328 331 if (!dax_alive(dax_dev)) 329 332 return false; 330 333 331 334 return dax_dev->ops->dax_supported(dax_dev, bdev, blocksize, start, len); 332 335 } 336 + EXPORT_SYMBOL_GPL(dax_supported); 333 337 334 338 size_t dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr, 335 339 size_t bytes, struct iov_iter *i)
+7 -3
drivers/md/dm-table.c
··· 860 860 int device_supports_dax(struct dm_target *ti, struct dm_dev *dev, 861 861 sector_t start, sector_t len, void *data) 862 862 { 863 - int blocksize = *(int *) data; 863 + int blocksize = *(int *) data, id; 864 + bool rc; 864 865 865 - return generic_fsdax_supported(dev->dax_dev, dev->bdev, blocksize, 866 - start, len); 866 + id = dax_read_lock(); 867 + rc = dax_supported(dev->dax_dev, dev->bdev, blocksize, start, len); 868 + dax_read_unlock(id); 869 + 870 + return rc; 867 871 } 868 872 869 873 /* Check devices support synchronous DAX */
+3 -2
drivers/md/dm.c
··· 1136 1136 { 1137 1137 struct mapped_device *md = dax_get_private(dax_dev); 1138 1138 struct dm_table *map; 1139 + bool ret = false; 1139 1140 int srcu_idx; 1140 - bool ret; 1141 1141 1142 1142 map = dm_get_live_table(md, &srcu_idx); 1143 1143 if (!map) 1144 - return false; 1144 + goto out; 1145 1145 1146 1146 ret = dm_table_supports_dax(map, device_supports_dax, &blocksize); 1147 1147 1148 + out: 1148 1149 dm_put_live_table(md, srcu_idx); 1149 1150 1150 1151 return ret;
+20 -2
include/linux/dax.h
··· 130 130 return __generic_fsdax_supported(dax_dev, bdev, blocksize, start, 131 131 sectors); 132 132 } 133 + bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev, 134 + int blocksize, sector_t start, sector_t len); 133 135 134 136 static inline void fs_put_dax(struct dax_device *dax_dev) 135 137 { ··· 155 153 static inline bool generic_fsdax_supported(struct dax_device *dax_dev, 156 154 struct block_device *bdev, int blocksize, sector_t start, 157 155 sector_t sectors) 156 + { 157 + return false; 158 + } 159 + 160 + static inline bool dax_supported(struct dax_device *dax_dev, 161 + struct block_device *bdev, int blocksize, sector_t start, 162 + sector_t len) 158 163 { 159 164 return false; 160 165 } ··· 198 189 } 199 190 #endif 200 191 192 + #if IS_ENABLED(CONFIG_DAX) 201 193 int dax_read_lock(void); 202 194 void dax_read_unlock(int id); 195 + #else 196 + static inline int dax_read_lock(void) 197 + { 198 + return 0; 199 + } 200 + 201 + static inline void dax_read_unlock(int id) 202 + { 203 + } 204 + #endif /* CONFIG_DAX */ 203 205 bool dax_alive(struct dax_device *dax_dev); 204 206 void *dax_get_private(struct dax_device *dax_dev); 205 207 long dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, long nr_pages, 206 208 void **kaddr, pfn_t *pfn); 207 - bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev, 208 - int blocksize, sector_t start, sector_t len); 209 209 size_t dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr, 210 210 size_t bytes, struct iov_iter *i); 211 211 size_t dax_copy_to_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr,