| Summary: | [FUSEFS] Fuse does not correctly set the owner field during FUSE_SETLK and FUSE_SETLKW | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Agata <chogata> | ||||
| Component: | kern | Assignee: | Alan Somers <asomers> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Some People | CC: | asomers, chogata, emaste, jSML4ThWwBID69YC, piotr.konopelko | ||||
| Priority: | --- | ||||||
| Version: | CURRENT | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| URL: | https://reviews.freebsd.org/D30622 | ||||||
| Attachments: |
|
||||||
|
Description
Agata
2021-05-19 17:30:48 UTC
Thanks for reporting this. I see the bug now. libfuse doesn't really define what the owner field is supposed to be, but the pid seems like a good choice. That's what FreeBSD uses for local locks. Linux does something more complicated, but I don't know that there's a good reason for it. I'll fix it. Created attachment 225109 [details]
Fix the lock owner field during FUSE_SETLK
Agata, could you please test MooseFS on FreeBSD 14.0-CURRENT with this patch?
Hi, I tested it with the patch, the script works now and the lock owner value is consistent in all calls. In code review now. Just a note, the provided patch applies cleanly to 13.0-RELEASE and resolves the issue. A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=18b19f8c6e04935a63a951afe0e540674bc94455 commit 18b19f8c6e04935a63a951afe0e540674bc94455 Author: Alan Somers <asomers@FreeBSD.org> AuthorDate: 2021-05-20 01:10:15 +0000 Commit: Alan Somers <asomers@FreeBSD.org> CommitDate: 2021-06-26 02:40:08 +0000 fusefs: correctly set lock owner during FUSE_SETLK During FUSE_SETLK, the owner field should uniquely identify the calling process. The fusefs module now sets it to the process's pid. Previously, it expected the calling process to set it directly, which was wrong. libfuse also apparently expects the owner field to be set during FUSE_GETLK, though I'm not sure why. PR: 256005 Reported by: Agata <chogata@moosefs.pro> MFC after: 2 weeks Reviewed by: pfg Differential Revision: https://reviews.freebsd.org/D30622 sys/fs/fuse/fuse_vnops.c | 4 ++-- tests/sys/fs/fusefs/locks.cc | 50 ++++++++++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 22 deletions(-) A commit in branch stable/12 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=7d9771228715bf2a32c7db323accecfb7f2f861c commit 7d9771228715bf2a32c7db323accecfb7f2f861c Author: Alan Somers <asomers@FreeBSD.org> AuthorDate: 2021-05-20 01:10:15 +0000 Commit: Alan Somers <asomers@FreeBSD.org> CommitDate: 2021-07-27 17:34:08 +0000 fusefs: correctly set lock owner during FUSE_SETLK During FUSE_SETLK, the owner field should uniquely identify the calling process. The fusefs module now sets it to the process's pid. Previously, it expected the calling process to set it directly, which was wrong. libfuse also apparently expects the owner field to be set during FUSE_GETLK, though I'm not sure why. PR: 256005 Reported by: Agata <chogata@moosefs.pro> Reviewed by: pfg Differential Revision: https://reviews.freebsd.org/D30622 (cherry picked from commit 18b19f8c6e04935a63a951afe0e540674bc94455) sys/fs/fuse/fuse_vnops.c | 4 ++-- tests/sys/fs/fusefs/locks.cc | 50 ++++++++++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 22 deletions(-) A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=c7fe00ae403f08b17e8376cc98195171234bf3d9 commit c7fe00ae403f08b17e8376cc98195171234bf3d9 Author: Alan Somers <asomers@FreeBSD.org> AuthorDate: 2021-05-20 01:10:15 +0000 Commit: Alan Somers <asomers@FreeBSD.org> CommitDate: 2021-07-27 17:44:28 +0000 fusefs: correctly set lock owner during FUSE_SETLK During FUSE_SETLK, the owner field should uniquely identify the calling process. The fusefs module now sets it to the process's pid. Previously, it expected the calling process to set it directly, which was wrong. libfuse also apparently expects the owner field to be set during FUSE_GETLK, though I'm not sure why. PR: 256005 Reported by: Agata <chogata@moosefs.pro> Reviewed by: pfg Differential Revision: https://reviews.freebsd.org/D30622 (cherry picked from commit 18b19f8c6e04935a63a951afe0e540674bc94455) sys/fs/fuse/fuse_vnops.c | 4 ++-- tests/sys/fs/fusefs/locks.cc | 50 ++++++++++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 22 deletions(-) |