Skip to content

Commit 7f4796a

Browse files
josefbacikjankara
authored andcommitted
xfs: add pre-content fsnotify hook for DAX faults
xfs has it's own handling for DAX faults, so we need to add the pre-content fsnotify hook for this case. Other faults go through filemap_fault so they're handled properly there. Signed-off-by: Josef Bacik <[email protected]> Signed-off-by: Jan Kara <[email protected]> Link: https://patch.msgid.link/9eccdf59a65b72f0a1a5e2f2b9bff8eda2d4f2d9.1731684329.git.josef@toxicpanda.com
1 parent 8392bc2 commit 7f4796a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

fs/xfs/xfs_file.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,6 +1443,9 @@ xfs_dax_read_fault(
14431443

14441444
trace_xfs_read_fault(ip, order);
14451445

1446+
ret = filemap_fsnotify_fault(vmf);
1447+
if (unlikely(ret))
1448+
return ret;
14461449
xfs_ilock(ip, XFS_MMAPLOCK_SHARED);
14471450
ret = xfs_dax_fault_locked(vmf, order, false);
14481451
xfs_iunlock(ip, XFS_MMAPLOCK_SHARED);
@@ -1471,6 +1474,16 @@ xfs_write_fault(
14711474
vm_fault_t ret;
14721475

14731476
trace_xfs_write_fault(ip, order);
1477+
/*
1478+
* Usually we get here from ->page_mkwrite callback but in case of DAX
1479+
* we will get here also for ordinary write fault. Handle HSM
1480+
* notifications for that case.
1481+
*/
1482+
if (IS_DAX(inode)) {
1483+
ret = filemap_fsnotify_fault(vmf);
1484+
if (unlikely(ret))
1485+
return ret;
1486+
}
14741487

14751488
sb_start_pagefault(inode->i_sb);
14761489
file_update_time(vmf->vma->vm_file);

0 commit comments

Comments
 (0)