From 579472f948238dcef9a3ef6a38cca451fb1a344a Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 24 Mar 2026 09:31:46 -0700 Subject: [PATCH] file locking --- FUSE-Mount.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/FUSE-Mount.md b/FUSE-Mount.md index 3e590e1..da78bb7 100644 --- a/FUSE-Mount.md +++ b/FUSE-Mount.md @@ -13,8 +13,23 @@ With "weed mount", the files can be operated as a local file. The following oper * display free disk space * copy file range * lseek +* advisory file locking (`flock(2)` and POSIX `fcntl(2)` byte-range locks) * extended attributes (xattr) +### Advisory File Locking + +SeaweedFS supports advisory file locking over FUSE: + +* whole-file locks via `flock(2)` +* POSIX byte-range locks via `fcntl(2)` (`F_SETLK`, `F_SETLKW`, `F_GETLK`) + +The locks follow normal close semantics: + +* POSIX `fcntl` locks are released when the closing lock owner closes the file +* `flock` locks are released with the file description close path + +These are advisory locks, so applications must cooperate by taking and honoring them. + ### Extended Attributes (xattr) SeaweedFS supports POSIX extended attributes on files and directories via FUSE mount. You can use standard tools like `setfattr`, `getfattr`, and `xattr` to manage custom metadata. @@ -365,4 +380,4 @@ From https://github.com/seaweedfs/seaweedfs/issues/877 Workaround is to use Linux capabilities on weed executable. setcap cap_net_raw,cap_net_admin,cap_dac_override+eip /usr/local/bin/weed After that you need to use "weed mount" with option allowOthers=false -``` \ No newline at end of file +```