From 7b6a47a0788da1d906a01e6e84b0d2c083252289 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Tue, 12 Mar 2024 20:02:51 -0400 Subject: [PATCH 1/9] Wait for notify thread to end before llfuse.main() completes. When fuse_session_remove_chan is called, the _notify_loop thread _must not_ be running or it may try to use the deleted channel and cause a segfault. --- src/fuse_api.pxi | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fuse_api.pxi b/src/fuse_api.pxi index a156f21..5606ad8 100644 --- a/src/fuse_api.pxi +++ b/src/fuse_api.pxi @@ -313,6 +313,7 @@ def main(workers=None, handle_signals=True): session_loop_single() else: session_loop_mt(workers) + t.join() if exc_info: # Re-raise expression from request handler From db9a16930e9c6240666d2aece8f3f5fe7deba2be Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Thu, 14 Mar 2024 10:35:03 -0400 Subject: [PATCH 2/9] Use an event variable to tell the notify queue to drain Intended to speed up the notify queue shut down if there are pending events when running tests that repeatedly create and destroy llfuse sessions. --- src/fuse_api.pxi | 2 ++ src/llfuse.pyx | 3 +++ src/misc.pxi | 6 +++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/fuse_api.pxi b/src/fuse_api.pxi index 5606ad8..7ebd08d 100644 --- a/src/fuse_api.pxi +++ b/src/fuse_api.pxi @@ -301,9 +301,11 @@ def main(workers=None, handle_signals=True): on_exit.callback(lambda: restore_signal_handlers()) # Start notification handling thread + _notify_queue_shutdown.clear() t = threading.Thread(target=_notify_loop) t.daemon = True t.start() + on_exit.callback(_notify_queue_shutdown.set) on_exit.callback(_notify_queue.put, None, block=True, timeout=5) on_exit.callback(lambda: fuse_session_reset(session)) diff --git a/src/llfuse.pyx b/src/llfuse.pyx index a8f5597..61dd46a 100644 --- a/src/llfuse.pyx +++ b/src/llfuse.pyx @@ -137,6 +137,9 @@ lock_released = NoLockManager.__new__(NoLockManager) cdef object _notify_queue _notify_queue = Queue(maxsize=1000) +cdef object _notify_queue_shutdown +_notify_queue_shutdown = threading.Event() + # Exported for access from Python code # (in the Cython source, we want ENOATTR to refer # to the C constant, not a Python object) diff --git a/src/misc.pxi b/src/misc.pxi index d93667c..04bbad3 100644 --- a/src/misc.pxi +++ b/src/misc.pxi @@ -267,7 +267,11 @@ def _notify_loop(): while True: req = _notify_queue.get() if req is None: - return + break + + if _notify_queue_shutdown.is_set(): + # Just drain the queue + continue if req.kind == NOTIFY_INVAL_INODE: if req.attr_only: From ce17735ed602971006b22a0f6f624197baa6ad43 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Thu, 14 Mar 2024 10:43:21 -0400 Subject: [PATCH 3/9] Update README and setup.py to indicate this is a fork. --- README.rst | 6 ++---- setup.py | 8 ++++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/README.rst b/README.rst index 3dbcfb4..8610c97 100644 --- a/README.rst +++ b/README.rst @@ -9,10 +9,8 @@ The Python-LLFUSE Module .. start-intro -**Warning - no longer developed!** - -Python-LLFUSE is no longer actively developed and just receiving -community-contributed maintenance to keep it alive for some time. +This is a fork of Python-LLFUSE used by the Arvados project to support +"arv-mount". Python-LLFUSE is a set of Python bindings for the low level FUSE_ API. It requires at least FUSE 2.8.0 and supports both Python 2.x and diff --git a/setup.py b/setup.py index 98136d0..82c4dd3 100755 --- a/setup.py +++ b/setup.py @@ -47,7 +47,7 @@ warnings.simplefilter('default') -LLFUSE_VERSION = '1.5.0' +LLFUSE_VERSION = '1.5.1' def main(): @@ -97,14 +97,14 @@ def main(): c_sources.append('src/darwin_compat.c') setuptools.setup( - name='llfuse', + name='arvados-llfuse', zip_safe=True, version=LLFUSE_VERSION, - description='Python bindings for the low-level FUSE API', + description='Arvados fork of Python bindings for the low-level FUSE API', long_description=long_desc, author='Nikolaus Rath', author_email='Nikolaus@rath.org', - url='https://github.com/python-llfuse/python-llfuse/', + url='https://github.com/arvados/python-llfuse/', license='LGPL', classifiers=['Development Status :: 4 - Beta', 'Intended Audience :: Developers', From e6e09bd1fcf52a6d18b7fff3c2c1b20c66285030 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Thu, 14 Mar 2024 11:15:59 -0400 Subject: [PATCH 4/9] Add note about which package has arv-mount. --- README.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 8610c97..034456c 100644 --- a/README.rst +++ b/README.rst @@ -10,7 +10,8 @@ The Python-LLFUSE Module .. start-intro This is a fork of Python-LLFUSE used by the Arvados project to support -"arv-mount". +"arv-mount". **If you are trying to install "arv-mount" you want the +"arvados_fuse" package.** Python-LLFUSE is a set of Python bindings for the low level FUSE_ API. It requires at least FUSE 2.8.0 and supports both Python 2.x and From 21e631e04c395d17c127f9b86c8336bffd3214db Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Thu, 14 Mar 2024 11:18:35 -0400 Subject: [PATCH 5/9] Switch some other links to our arvados fork. --- README.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 034456c..027fa67 100644 --- a/README.rst +++ b/README.rst @@ -40,8 +40,8 @@ The Python-LLFUSE source code is available on GitHub_. .. __: https://llfuse.readthedocs.io/ .. _FUSE: http://github.com/libfuse/libfuse .. _FUSE mailing list: https://lists.sourceforge.net/lists/listinfo/fuse-devel -.. _issue tracker: https://github.com/python-llfuse/python-llfuse/issues +.. _issue tracker: https://github.com/arvados/python-llfuse/issues .. _mailing list archive: http://dir.gmane.org/gmane.comp.file-systems.fuse.devel .. _Gmane: http://www.gmane.org/ -.. _PyPi: https://pypi.python.org/pypi/llfuse/ -.. _GitHub: https://github.com/python-llfuse/python-llfuse +.. _PyPi: https://pypi.python.org/pypi/arvados-llfuse/ +.. _GitHub: https://github.com/arvados/python-llfuse From 5fc78fae4989703a5d1d7816fcf247e5cbdf7f5d Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Thu, 14 Mar 2024 13:04:48 -0400 Subject: [PATCH 6/9] Update version and add note to Changes.rst --- Changes.rst | 9 ++++++++- rst/conf.py | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Changes.rst b/Changes.rst index 3ba1403..ade251e 100644 --- a/Changes.rst +++ b/Changes.rst @@ -4,7 +4,14 @@ .. currentmodule:: llfuse -**WARNING**: Python-LLFUSE is no longer actively developed. +Release 1.5.1 (2024-03-14) +========================== + +- Forked as arvados-llfuse +- Now waits for the _notify_loop thread to complete before exiting + from main(). This prevents a segfault after llfuse.close() removes + the channel but the _notify_loop thread is still executing with + pending notify events and tries to send on the (removed) channel. Release 1.5.0 (2023-08-08) ========================== diff --git a/rst/conf.py b/rst/conf.py index d2b3a2c..f03bdcc 100644 --- a/rst/conf.py +++ b/rst/conf.py @@ -59,7 +59,7 @@ # built documents. # # The short X.Y version. -version = '1.5.0' +version = '1.5.1' # The full version, including alpha/beta/rc tags. release = version + '' From 6809896f69d821d5320183711a122fef5709e795 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Thu, 14 Mar 2024 13:11:27 -0400 Subject: [PATCH 7/9] Adjust the release scripts for the fork. --- util/sdist-sign | 4 ++-- util/upload-pypi | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/util/sdist-sign b/util/sdist-sign index 43aec12..13e397b 100755 --- a/util/sdist-sign +++ b/util/sdist-sign @@ -15,6 +15,6 @@ fi python setup.py sdist -D=dist/llfuse-$R.tar.gz +D=dist/arvados-llfuse-$R.tar.gz -$GPG --detach-sign --local-user "Thomas Waldmann" --armor --output $D.asc $D +$GPG --detach-sign --local-user "Peter Amstutz" --armor --output $D.asc $D diff --git a/util/upload-pypi b/util/upload-pypi index 300b53a..79ed932 100755 --- a/util/upload-pypi +++ b/util/upload-pypi @@ -13,6 +13,6 @@ else export TWINE_REPOSITORY_URL= fi -D=dist/llfuse-$R.tar.gz +D=dist/arvados-llfuse-$R.tar.gz twine upload $D From 638d7512e527d8d133f59604bcfa50f09a630d7a Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Fri, 5 Apr 2024 12:21:52 -0400 Subject: [PATCH 8/9] Revert "drop Python 3.5 3.6 3.7, fixes #69" This reverts commit c7feaa02e0f5004bd9e62348ca1cc74aad945288. --- .github/workflows/test.yml | 2 +- setup.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bca015a..3beb6e4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12-dev"] + python-version: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12-dev"] cython-version: ["0.29", "3.0"] os: [ubuntu-20.04] diff --git a/setup.py b/setup.py index 82c4dd3..da1da2d 100755 --- a/setup.py +++ b/setup.py @@ -110,6 +110,9 @@ def main(): 'Intended Audience :: Developers', 'Programming Language :: Python', 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', @@ -125,7 +128,7 @@ def main(): keywords=['FUSE', 'python' ], package_dir={'': 'src'}, packages=setuptools.find_packages('src'), - python_requires='>=3.8', + python_requires='>=3.5', tests_require=['pytest >= 3.4.0'], provides=['llfuse'], ext_modules=[Extension('llfuse', c_sources, From f019d61247abbd95106bfb4a9e9c7f52316617f0 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Fri, 5 Apr 2024 12:22:23 -0400 Subject: [PATCH 9/9] Bump arvados-llfuse 1.5.2 to restore support for Python 3.6+ Besides going out of support, the started reason for dropping Python 3.5 was to silence a deprecation warning about PyEval_InitThreads, however it appears that Cython already take care of this -- on inspecting the C code, PyEval_InitThreads is called conditionally when importing the llfuse module. Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index da1da2d..2d9fb15 100755 --- a/setup.py +++ b/setup.py @@ -47,7 +47,7 @@ warnings.simplefilter('default') -LLFUSE_VERSION = '1.5.1' +LLFUSE_VERSION = '1.5.2' def main():