Bug 762774 (GLUSTER-1042)

Summary: Use correct flock structures in lk fops
Product: [Community] GlusterFS Reporter: Pavan Vilas Sondur <pavan>
Component: replicateAssignee: Pavan Vilas Sondur <pavan>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: urgent    
Version: mainlineCC: fharshav, gluster-bugs, lakshmipathi, vijay
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: RTP Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Pavan Vilas Sondur 2010-07-01 15:22:18 UTC
Currently, flock structures are not being used properly. Correct their usage, by separating out the user supplied flock with the 'returned' flock structure.

Test for fix:

Patch1

* For F_SETLK type calls (cmd == F_SETLK)
   - All servers get the same flock structure. (verify using 'option trace on' in the locks xlator on server(s))
   - Return flock does not matter.
* For F_SETLKW type calls (cmd == F_SETLKW)
   SAME AS ABOVE
* For F_UNLCK type calls (cmd == F_UNLCK)
   SAME AS ABOVE

* For F_GETLK type calls (cmd == F_GETLK)
  - All servers should get the same flock structure
  - The returned flock should be the flock structure, where the lk call was successful:
     * If all fail, returned flock does not matter
     * Partial failure: returned flock from any server where flock was successful.


Patch2

* Correct error messages in the log and failure of lk call (return value = -1 and errno = EINVAL) when flock is not filled properly:
  * Negative l_len values
  * Negative l_start values


Will attach 2 c programs to verify the above.

Comment 1 Anand Avati 2010-07-02 04:01:06 UTC
PATCH: http://patches.gluster.com/patch/3513 in release-3.0 (cluster/afr: Return correct flock structures correctly in lk fops.)

Comment 2 Anand Avati 2010-07-02 04:01:10 UTC
PATCH: http://patches.gluster.com/patch/3514 in release-3.0 (features/locks: Check flock structure before proceeding with the lk call.)

Comment 3 Anand Avati 2010-07-02 13:39:27 UTC
PATCH: http://patches.gluster.com/patch/3522 in release-3.0 (write-behind: fixes in flush)

Comment 4 Harshavardhana 2010-07-29 23:52:34 UTC
(In reply to comment #0)
> Currently, flock structures are not being used properly. Correct their usage,
> by separating out the user supplied flock with the 'returned' flock structure.
> 
> Test for fix:
> 
> Patch1
> 
> * For F_SETLK type calls (cmd == F_SETLK)
>    - All servers get the same flock structure. (verify using 'option trace on'
> in the locks xlator on server(s))
>    - Return flock does not matter.
> * For F_SETLKW type calls (cmd == F_SETLKW)
>    SAME AS ABOVE
> * For F_UNLCK type calls (cmd == F_UNLCK)
>    SAME AS ABOVE
> 
> * For F_GETLK type calls (cmd == F_GETLK)
>   - All servers should get the same flock structure
>   - The returned flock should be the flock structure, where the lk call was
> successful:
>      * If all fail, returned flock does not matter
>      * Partial failure: returned flock from any server where flock was
> successful.
> 
> 
> Patch2
> 
> * Correct error messages in the log and failure of lk call (return value = -1
> and errno = EINVAL) when flock is not filled properly:
>   * Negative l_len values
>   * Negative l_start values
> 
> 
> Will attach 2 c programs to verify the above.

where are the two "C" programs to be attached?

Comment 5 Anand Avati 2010-08-17 15:18:10 UTC
PATCH: http://patches.gluster.com/patch/4169 in master (cluster/afr: Return correct flock structures correctly in lk fops)

Comment 6 Vijay Bellur 2010-09-01 06:58:17 UTC
*** Bug 1039 has been marked as a duplicate of this bug. ***