[Bugs] [Bug 1241104] New: Handle negative fcntl flock->l_len values

bugzilla at redhat.com bugzilla at redhat.com
Wed Jul 8 12:51:37 UTC 2015


https://bugzilla.redhat.com/show_bug.cgi?id=1241104

            Bug ID: 1241104
           Summary: Handle negative fcntl flock->l_len values
           Product: GlusterFS
           Version: mainline
         Component: locks
          Severity: urgent
          Assignee: bugs at gluster.org
          Reporter: skoduri at redhat.com
                CC: bugs at gluster.org, gluster-bugs at redhat.com



Description of problem:

As per 'man 3 fcntl', 
       If  l_len  is positive, the area affected shall start at l_start and end
at l_start+l_len−1.  If l_len is negative, the area affected shall start at
l_start+l_len and end at l_start−1.  Locks may start and extend beyond the
current end  of a file, but shall not extend before the beginning of the file.
A lock shall be set to extend to the largest possible value of the file offset
for that file by setting l_len to 0. If such a lock also has l_start set to 0
and

But in the current lock handling,

int
pl_lk (call_frame_t *frame, xlator_t *this,
       fd_t *fd, int32_t cmd, struct gf_flock *flock, dict_t *xdata)
{
......
.........

        if ((flock->l_start < 0) || (flock->l_len < 0)) {
                op_ret = -1;
                op_errno = EINVAL;
                goto unwind;
        }
.......
.......
}

We invariably return error if l_len is found to be negative. It needs to be
fixed.

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


More information about the Bugs mailing list