[Bug 266886] [FUSEFS] Handling of l_whence with fcntl(F_GETLK)

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 12 Oct 2022 04:03:50 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=266886

--- Comment #2 from John Millikin <jmillikin@gmail.com> ---
I think my initial message was partially incorrect -- the offsets are being
calculated correctly, it's just that `l_whence` doesn't get set to `SEEK_SET`
when the call is complete.

        /* &fl populated per your example */
        fcntl(fd, F_GETLK, &fl));

        /* fuse server request and response
        RECV fuse_lk_in  { lk: fuse_file_lock { start: 500, end: 509, .. }, ..
}
        SEND fuse_lk_out { lk: fuse_file_lock { start: 500, end: 509, .. } }
        */

        ASSERT_EQ(fl.l_start, 500);
        ASSERT_EQ(fl.l_len, 10);
        ASSERT_EQ(fl.l_whence, SEEK_SET); /* fails */

In other words, I would expect one of the following to be true after fcntl
returns:

1. l_start is an absolute location within the file, and l_whence is SEEK_SET.
2. l_start is relative to the file position, and l_whence is SEEK_CUR.

-- 
You are receiving this mail because:
You are the assignee for the bug.