On Jul 27 2023, Nikolaus Rath <Nikolaus@xxxxxxxx> wrote: > On Jul 27 2023, Miklos Szeredi via fuse-devel <fuse-devel@xxxxxxxxxxxxxxxxxxxxx> wrote: >> On Wed, 26 Jul 2023 at 20:09, Nikolaus Rath <Nikolaus@xxxxxxxx> wrote: >>> >>> Hello, >>> >>> It seems to me that fuse_notify_delete >>> (https://elixir.bootlin.com/linux/v6.1/source/fs/fuse/dev.c#L1512) fails >>> with ENOTEMPTY if there is a pending FORGET request for a directory >>> entry within. Is that correct? >> >> It's bug if it does that. >> >> The code related to NOTIFY_DELETE in fuse_reverse_inval_entry() seems >> historic. It's supposed to be careful about mountpoints and >> referenced dentries, but d_invalidate() should have already gotten all >> that out of the way and left an unhashed dentry without any submounts >> or children. The checks just seem redundant, but not harmful. >> >> If you are managing to trigger the ENOTEMPTY case, then something >> strange is going on, and we need to investigate. > > I can trigger this reliable on kernel 6.1.0-10-amd64 (Debian stable) > with this sequence of operations: > > $ mkdir test > $ echo foo > test/bar > $ Trigger removal of test/bar and then test within the filesystem (not > through unlink()/rmdir() but out-of-band) > > > What can I do to help with the investigation? I've pushed an instrumented snapshot to https://github.com/s3ql/s3ql/tree/notify_delete_bug. For me, this reliably reproduces the problem: $ python3 setup.py build_cython build_ext --inplace $ md bucket $ bin/mkfs.s3ql --plain local://bucket [...] $ bin/mount.s3ql --fg local://bucket mnt & [...] $ md mnt/test; echo foo > mnt/test/bar $ bin/s3qlrm mnt/test fuse: writing device: Directory not empty ERROR: Failed to submit invalidate_entry request for parent inode 1, name b'test' Traceback (most recent call last): File "src/internal.pxi", line 125, in pyfuse3._notify_loop File "src/pyfuse3.pyx", line 915, in pyfuse3.invalidate_entry OSError: [Errno 39] fuse_lowlevel_notify_delete returned: Directory not empty I've looked into reproducing this with e.g. example/passthrough_ll.c, but it's non-trivial because of the need to run notify_delete in a separate thread and giving it all the right arguments. I can look into it more if that's needed though. Best, -Nikolaus