Bug 762782 (GLUSTER-1050) - fcntl F_GETLK lock calls do not return correct flock on non-linux systems
Summary: fcntl F_GETLK lock calls do not return correct flock on non-linux systems
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: GLUSTER-1050
Product: GlusterFS
Classification: Community
Component: protocol
Version: mainline
Hardware: All
OS: Solaris
medium
medium
Target Milestone: ---
Assignee: Pranith Kumar K
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-07-06 06:35 UTC by Pavan Vilas Sondur
Modified: 2015-12-01 16:45 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Regression: RTP
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:


Attachments (Terms of Use)

Description Pavan Vilas Sondur 2010-07-06 03:50:14 UTC
Test Plan:
1. Call a fcntl lock as following:
   sample flock structure:
   flock.l_type = F_WRLCK;
   flock.l_start = 0;
   flock.l_len   = 0; //whole file
   flock.l_whence = SEEK_START;
   
   fcntl (fd, F_SETLK, &flock);

2. While the above lock is taken (not unlocked) and fd not closed issue another fcntl call as a F_GETLK as following:
   flock.l_type = F_RDLCK;
   flock.l_start = 0;
   flock.l_len = 0; //whole file
   flock.l_whence = SEEK_START;

   fcntl (fd, F_GETLK, &flock);

This call should result in the flock structure changing to a type of F_UNLCK and the pid of the conflicting lock (pid of the process used in step 1) along with the other structures getting filled appropriately.

The bug is hit, where the l_type returned changes when the server is non-linux (Solaris). Verify on a Solaris server setup that the conflicting lock's flock is exactly the same.

Comment 1 Pavan Vilas Sondur 2010-07-06 06:35:43 UTC
server/protocol's getlk implementation needs to convert the flock on the system to glfs own flock before returning it to the client to prevent misinterpretation of the flock structure.

Comment 2 Anand Avati 2010-07-14 18:44:24 UTC
PATCH: http://patches.gluster.com/patch/3592 in master (v2 [PATCH BUG:1050] protocol/server Convert-OS-specific-lock-value-to-Glusterfs-lock)

Comment 3 Anand Avati 2010-07-14 18:44:49 UTC
PATCH: http://patches.gluster.com/patch/3594 in release-3.0 (v2 [PATCH BRANCH:release-3.0 BUG:1050] protocol/server: Convert OS specific lock value to Gluster lock value)

Comment 4 Pranith Kumar K 2010-07-15 03:31:56 UTC
test case URL:
http://test.gluster.com/show_bug.cgi?id=80


Note You need to log in before you can comment on or make changes to this bug.