Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vfs: fix the issue that plock may be unlocked by mistake #4910

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/vfs/vfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ func (v *VFS) Release(ctx Context, ino Ino, fh uint64) {
v.invalidateAttr(ino)
}
if locks&1 != 0 {
_ = v.Meta.Flock(ctx, ino, fowner, F_UNLCK, false)
_ = v.Meta.Flock(ctx, ino, fowner^fh, F_UNLCK, false)
}
if locks&2 != 0 && powner != 0 {
_ = v.Meta.Setlk(ctx, ino, powner, false, F_UNLCK, 0, 0x7FFFFFFFFFFFFFFF, 0)
Expand Down
2 changes: 1 addition & 1 deletion pkg/vfs/vfs_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ func (v *VFS) Flock(ctx Context, ino Ino, fh uint64, owner uint64, typ uint32, b
}
h.addOp(ctx)
defer h.removeOp(ctx)
err = v.Meta.Flock(ctx, ino, owner, typ, block)
err = v.Meta.Flock(ctx, ino, owner^fh, typ, block)
if err == 0 {
h.Lock()
if typ == syscall.F_UNLCK {
Expand Down
Loading