[Bug 255945] FuseFS breaks Flock on FreeBSD 13 RELEASE

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 17 May 2021 14:54:11 +0000
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255945

            Bug ID: 255945
           Summary: FuseFS breaks Flock on FreeBSD 13 RELEASE
           Product: Base System
           Version: 13.0-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: bugs_at_FreeBSD.org
          Reporter: jSML4ThWwBID69YC_at_protonmail.com

Hello, 

Flock no longer works on FreeBSD 13p0 when using FuseFS. This has been tested
with two different fusefs clients. 

Tested: MooseFS 3.0.115 from the ports tree. 
Tested: fusefs-sshfs-3.7.1 from packages. 

Here's a simple test to demonstrate the issue using sshfs. 

1: Install fusefs-sshfs, flock, and bash.

pkg install fusefs-sshfs flock bash

2: Create a sshfs mount. You can do this locally by allowing root login over
ssh, or any other user. I'll use root to avoid any permission type issues. 

service sshd onestart
mkdir /mnt/test
sshfs root_at_127.0.0.1:/root /mnt/test

The contents of /root should now be showing at /mnt/test

3: Create the test script at /mnt/test/flock-test.sh 

-------------------
#!/usr/bin/env bash

exec 200> ./lock.file
echo "Acquire lock"
flock -n 200 || exit 1
echo "Sleep 5 secs."
sleep 5
echo "Release lock"
flock -u 200 || exit 2
echo "Lock released"
exit
---------------

4: Make the script executable

chmod u+x flock-test.sh

5: Run the script twice. 

./flock-test.sh

There seems to be different errors depending on if the 'lock.file' previously
exists. 

Note, the same issue happens on MooseFS, but it's more complicated to setup.
Here are MooseFS setup instructions, previously written for bug #245689,
https://bz-attachments.freebsd.org/attachment.cgi?id=213598

The flock-test.sh script works as expected on FreeBSD 12.2.

-- 
You are receiving this mail because:
You are the assignee for the bug.
Received on Mon May 17 2021 - 14:54:11 UTC

Original text of this message