Message ID | 9627e80117638745c2f4341eb8ac94f63ea9acee.1723670362.git.josef@toxicpanda.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
Series | fanotify: add pre-content hooks | expand |
On Wed 14-08-24 17:25:32, 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> Looks good to me. Would be nice to get ack from bcachefs guys. Kent? Honza > --- > 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 >
On Thu, Aug 29, 2024 at 01:10:55PM GMT, Jan Kara wrote: > On Wed 14-08-24 17:25:32, 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> > > Looks good to me. Would be nice to get ack from bcachefs guys. Kent? I said I wanted the bcachefs side tested, and offered Josef CI access for that - still waiting to hear from him.
On Thu, Aug 29, 2024 at 01:10:55PM GMT, Jan Kara wrote: > On Wed 14-08-24 17:25:32, 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> > > Looks good to me. Would be nice to get ack from bcachefs guys. Kent? btw, happy to give you a CI account as well: just need username and ssh pubkey
On Thu, Aug 29, 2024 at 07:26:42AM -0400, Kent Overstreet wrote: > On Thu, Aug 29, 2024 at 01:10:55PM GMT, Jan Kara wrote: > > On Wed 14-08-24 17:25:32, 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> > > > > Looks good to me. Would be nice to get ack from bcachefs guys. Kent? > > I said I wanted the bcachefs side tested, and offered Josef CI access > for that - still waiting to hear from him. My bad I thought I had responded. I tested bcachefs, xfs, ext4, and btrfs with my tests. I'll get those turned into fstests today/tomorrow. Thanks, Josef
On Thu, Aug 29, 2024 at 08:46:07AM GMT, Josef Bacik wrote: > On Thu, Aug 29, 2024 at 07:26:42AM -0400, Kent Overstreet wrote: > > On Thu, Aug 29, 2024 at 01:10:55PM GMT, Jan Kara wrote: > > > On Wed 14-08-24 17:25:32, 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> > > > > > > Looks good to me. Would be nice to get ack from bcachefs guys. Kent? > > > > I said I wanted the bcachefs side tested, and offered Josef CI access > > for that - still waiting to hear from him. > > My bad I thought I had responded. I tested bcachefs, xfs, ext4, and btrfs with > my tests. I'll get those turned into fstests today/tomorrow. Thanks, Acked-by: Kent Overstreet <kent.overstreet@linux.dev>
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(+)