Message ID | b3fc6d63e23626033ff2764a82d3e20a059ac8a4.1723228772.git.josef@toxicpanda.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | fanotify: add pre-content hooks | expand |
On Fri, Aug 09, 2024 at 02:44:22PM GMT, Josef Bacik wrote: > bcachefs has its own locking around filemap_fault, so we have to make > sure we do the fsnotify hook before the locking. Add the check to emit > the event before the locking and return VM_FAULT_RETRY to retrigger the > fault once the event has been emitted. > > Signed-off-by: Josef Bacik <josef@toxicpanda.com> Acked-by: Kent Overstreet <kent.overstreet@linux.dev> Josef, are you testing this on bcachefs as well? I'll get you an account for my CI if you want it (which has automated tests for more than bcachefs). > --- > fs/bcachefs/fs-io-pagecache.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/fs/bcachefs/fs-io-pagecache.c b/fs/bcachefs/fs-io-pagecache.c > index a9cc5cad9cc9..1fa1f1ac48c8 100644 > --- a/fs/bcachefs/fs-io-pagecache.c > +++ b/fs/bcachefs/fs-io-pagecache.c > @@ -570,6 +570,10 @@ vm_fault_t bch2_page_fault(struct vm_fault *vmf) > if (fdm == mapping) > return VM_FAULT_SIGBUS; > > + ret = filemap_maybe_emit_fsnotify_event(vmf); > + if (unlikely(ret)) > + return ret; > + > /* Lock ordering: */ > if (fdm > mapping) { > struct bch_inode_info *fdm_host = to_bch_ei(fdm->host); > -- > 2.43.0 >
diff --git a/fs/bcachefs/fs-io-pagecache.c b/fs/bcachefs/fs-io-pagecache.c index a9cc5cad9cc9..1fa1f1ac48c8 100644 --- a/fs/bcachefs/fs-io-pagecache.c +++ b/fs/bcachefs/fs-io-pagecache.c @@ -570,6 +570,10 @@ vm_fault_t bch2_page_fault(struct vm_fault *vmf) if (fdm == mapping) return VM_FAULT_SIGBUS; + ret = filemap_maybe_emit_fsnotify_event(vmf); + if (unlikely(ret)) + return ret; + /* Lock ordering: */ if (fdm > mapping) { struct bch_inode_info *fdm_host = to_bch_ei(fdm->host);
bcachefs has its own locking around filemap_fault, so we have to make sure we do the fsnotify hook before the locking. Add the check to emit the event before the locking and return VM_FAULT_RETRY to retrigger the fault once the event has been emitted. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- fs/bcachefs/fs-io-pagecache.c | 4 ++++ 1 file changed, 4 insertions(+)