[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241121102248.w3jkpcn3wosxbh62@quack3>
Date: Thu, 21 Nov 2024 11:22:48 +0100
From: Jan Kara <jack@...e.cz>
To: Josef Bacik <josef@...icpanda.com>
Cc: kernel-team@...com, linux-fsdevel@...r.kernel.org, jack@...e.cz,
amir73il@...il.com, brauner@...nel.org,
torvalds@...ux-foundation.org, viro@...iv.linux.org.uk,
linux-xfs@...r.kernel.org, linux-btrfs@...r.kernel.org,
linux-mm@...ck.org, linux-ext4@...r.kernel.org
Subject: Re: [PATCH v8 17/19] xfs: add pre-content fsnotify hook for write
faults
On Fri 15-11-24 10:30:30, Josef Bacik wrote:
> xfs has it's own handling for write faults, so we need to add the
> pre-content fsnotify hook for this case. Reads go through filemap_fault
> so they're handled properly there.
>
> Signed-off-by: Josef Bacik <josef@...icpanda.com>
This was missing proper handling for DAX read faults. What I've ended up
with is:
struct xfs_inode *ip = XFS_I(file_inode(vmf->vma->vm_file));
vm_fault_t ret;
+ ret = filemap_fsnotify_fault(vmf);
+ if (unlikely(ret))
+ return ret;
xfs_ilock(ip, XFS_MMAPLOCK_SHARED);
ret = xfs_dax_fault_locked(vmf, order, false);
xfs_iunlock(ip, XFS_MMAPLOCK_SHARED);
@@ -1412,6 +1415,17 @@ xfs_write_fault(
unsigned int lock_mode = XFS_MMAPLOCK_SHARED;
vm_fault_t ret;
+ /*
+ * Usually we get here from ->page_mkwrite callback but in case of DAX
+ * we will get here also for ordinary write fault. Handle HSM
+ * notifications for that case.
+ */
+ if (IS_DAX(inode)) {
+ ret = filemap_fsnotify_fault(vmf);
+ if (unlikely(ret))
+ return ret;
+ }
+
sb_start_pagefault(inode->i_sb);
file_update_time(vmf->vma->vm_file);
Honza
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists