Bug 731775

Summary: dlm: dev_write no op messages when flocks are used my multiple processes
Product: Red Hat Enterprise Linux 6 Reporter: Nate Straz <nstraz>
Component: clusterAssignee: David Teigland <teigland>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2CC: ccaulfie, cluster-maint, fdinitto, jpayne, lhh, rpeterso, sbradley, teigland
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: cluster-3.0.12.1-13.el6 Doc Type: Bug Fix
Doc Text:
Cause: the patch for bug 678585 was incomplete. dlm_controld was still passing error results back to the kernel for posix unlock operations flagged with CLOSE. Consequence: the kernel complains if it receives a posix lock result that it is not expecting: "dev_write no op ...". Many of these can appear, especially when using flocks (not posix locks). Fix: dlm_controld is fixed to not pass error results to the kernel for posix unlock operations flagged with CLOSE. Result: No "dev_write no op" messages should appear.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 14:52:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
the fix none

Description Nate Straz 2011-08-18 15:32:42 UTC
Description of problem:

When running tests with use flocks and multiple processes the console can be flooded with messages like this:

dlm: dev_write no op 2cb1031c a593
dlm: dev_write no op 2cb1031c a593
dlm: dev_write no op 2cb1031c a593

This message was added to catch problems with posix locks (fcntl).

Version-Release number of selected component (if applicable):
kernel-2.6.32-188.el6.x86_64
cman-3.0.12.1-10.el6.x86_64

How reproducible:
Easily

Steps to Reproduce:
PATH=$PATH:/usr/tests/sts-rhel6.2/bin; xiogen -S 13481  -m random -o -t 1b -T 1000b -F 1000b:/mnt/gfs2/flockfile | xdoio -v -i 50 -K -n 2
  
Actual results:
kernel messages are generated

Expected results:
no kernel messages are generated

Additional info:

Comment 3 David Teigland 2011-08-18 19:28:09 UTC
The bug is in dlm_controld.

Comment 4 David Teigland 2011-08-18 19:29:26 UTC
Created attachment 518927 [details]
the fix

    dlm_controld: fix plock dev_write no op
    
    When a plock unlock is received due to the file
    being closed (the CLOSE flag is set), we should
    not write an unlock result back to the kernel.
    If we do, the kernel, which does not expect a
    reply, will report the error "dev_write no op".
    
    In cases where dlm_controld encounters and error
    handling the unlock operation, it was writing
    the error result back to the kernel, even though
    the unlock was flagged with CLOSE.  The fix is
    to check for the CLOSE flag and skip writing
    the error result, as we do with normal results.
    
    This problem is especially visible when using
    flocks (not plocks).  This is because the kernel
    generates extraneous plock unlock requests
    when files are closed with flocks.  Because
    dlm_controld finds no plocks on the files,
    it replies to the kernel with an error, rather
    than skipping the reply to do CLOSE.

Comment 5 David Teigland 2011-08-18 19:37:13 UTC
There are two ways reproduce this problem and likewise verify it is fixed:
(here using people.redhat.com/teigland/doflock.c)

1. close a file with an flock on it

# touch /gfs/a
# ./doflock /gfs/a 1 1 0 2000000 1
there should be no dev_write error

2. run two processes both opening/locking/unlocking/closing the same file

# touch /gfs/a
# ./doflock /gfs/a 1 1 1 10000 1000 & ./doflock /gfs/a 1 1 1 10000 1000
there should be no dev_write errors

Both tests create the error message prior to the fix, and don't after the fix.

Comment 7 David Teigland 2011-08-19 17:02:28 UTC
For the record, I sent a patch upstream to eliminate the unnecessary posix unlocks when using flocks.  I don't know if it will be accepted or not.
http://marc.info/?l=linux-fsdevel&m=131377298029915&w=2

Comment 9 David Teigland 2011-10-27 14:35:19 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: the patch for bug 678585 was incomplete.  dlm_controld was still passing error results back to the kernel for posix unlock operations flagged with CLOSE.
Consequence: the kernel complains if it receives a posix lock result that it is not expecting: "dev_write no op ...".  Many of these can appear, especially when using flocks (not posix locks).
Fix: dlm_controld is fixed to not pass error results to the kernel for posix unlock operations flagged with CLOSE.
Result: No "dev_write no op" messages should appear.

Comment 10 Justin Payne 2011-11-03 19:26:23 UTC
Verified fixed using tests from Description comment, as well as both tests in comment #5.

# uname -r; rpm -q cman
2.6.32-203.el6.x86_64
cman-3.0.12.1-23.el6.x86_64

Comment 11 errata-xmlrpc 2011-12-06 14:52:54 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2011-1516.html