Hide Forgot
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.
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.
PATCH: http://patches.gluster.com/patch/3592 in master (v2 [PATCH BUG:1050] protocol/server Convert-OS-specific-lock-value-to-Glusterfs-lock)
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)
test case URL: http://test.gluster.com/show_bug.cgi?id=80