@@ -49,6 +49,7 @@ config FS_DAX
select DEV_PAGEMAP_OPS if (ZONE_DEVICE && !FS_DAX_LIMITED)
select FS_IOMAP
select DAX
+ select EXPORTFS_BLOCK_OPS
help
Direct Access (DAX) can be used on memory-backed block devices.
If the block device supports DAX and the filesystem supports DAX,
@@ -756,6 +756,9 @@ xfs_break_dax_layouts(
if (!page)
return 0;
+ if (page_gup_pinned(page))
+ return -ETXTBSY;
+
*retry = true;
return ___wait_var_event(&page->_refcount,
atomic_read(&page->_refcount) == 1, TASK_INTERRUPTIBLE,
@@ -779,10 +782,11 @@ xfs_break_layouts(
retry = false;
switch (reason) {
case BREAK_UNMAP:
- error = xfs_break_dax_layouts(inode, &retry, off, len);
+ error = xfs_break_leased_layouts(inode, iolock, &retry);
if (error || retry)
break;
- /* fall through */
+ error = xfs_break_dax_layouts(inode, &retry, off, len);
+ break;
case BREAK_WRITE:
error = xfs_break_leased_layouts(inode, iolock, &retry);
break;
@@ -21,14 +21,14 @@
#include "xfs_pnfs.h"
/*
- * Ensure that we do not have any outstanding pNFS layouts that can be used by
- * clients to directly read from or write to this inode. This must be called
- * before every operation that can remove blocks from the extent map.
- * Additionally we call it during the write operation, where aren't concerned
- * about exposing unallocated blocks but just want to provide basic
+ * Ensure that we do not have any outstanding pNFS or longterm GUP layouts that
+ * can be used by clients to directly read from or write to this inode. This
+ * must be called before every operation that can remove blocks from the extent
+ * map. Additionally we call it during the write operation, where aren't
+ * concerned about exposing unallocated blocks but just want to provide basic
* synchronization between a local writer and pNFS clients. mmap writes would
- * also benefit from this sort of synchronization, but due to the tricky locking
- * rules in the page fault path we don't bother.
+ * also benefit from this sort of synchronization, but due to the tricky
+ * locking rules in the page fault path we don't bother.
*/
int
xfs_break_leased_layouts(