aboutsummaryrefslogtreecommitdiffstats
path: root/test/wrong_command.c
diff options
context:
space:
mode:
authorBernd Schubert <bschubert@ddn.com>2024-01-10 15:11:34 +0100
committerBernd Schubert <bernd.schubert@fastmail.fm>2024-02-26 20:37:53 +0100
commit420a6c3c5da2cbcc2276be7fb767ecc5a884cac7 (patch)
treeee680ec67c24112ee1c1a381f62f6376e719c53a /test/wrong_command.c
parent31bf17c7448944a04d4c84df534013a4d6924acc (diff)
downloadlibfuse-420a6c3c5da2cbcc2276be7fb767ecc5a884cac7.tar.gz
example/notify_store_retrieve: Fix races and handle errors
This test was racy, the lookup counter must only be increased once kernel side has lookup completed and knows about the inode. However, this is still racy as app thread (python script) kernel-side libfuse thread kernel ---------------------------------------------------------------------- open file lookup req wait handle req reply wake app thread return new_inode() <continue file open> So actually on libfuse side even after returning from kernel side it is not ensured that the kernel has created the inode. I.e. using lookup_cnt in the test is still racy. A new variabled 'open_cnt' is added that is only increased in open Using open_cnt should be safe to use as kernel side (with atomic-open) first does lookup, from that data creates the inode and only then sends an open request. I.e. update_fs_loop() must only call fuse_lowlevel_notify_store() once it is absolutely sure kernel side has created the inode (open_cnt) and when it is sure the kernel inode still exists (lookup_cnt). Not really nice, but we actually need to accept some errors, as these still come up at umount time. Typically it is hard to hit, but tests in github actually frequently get it. Actually, it can be easily reproduced by commenting out the sleep line in update_fs_loop(). Underlying issue is that kernel side is sending ->destroy() only when it already internally released all inodes - too late for this test. The errors I run into are ENOENT and EBADFD, but I added back in ENODEV for safety. In order to avoid any other kind races mutex lock is also introduced.
Diffstat (limited to 'test/wrong_command.c')
0 files changed, 0 insertions, 0 deletions