Bug 154990 - dlm returns incorrect result to userspace on lock error
dlm returns incorrect result to userspace on lock error
Status: CLOSED ERRATA
Product: Red Hat Cluster Suite
Classification: Red Hat
Component: dlm (Show other bugs)
4
All Linux
medium Severity medium
: ---
: ---
Assigned To: Christine Caulfield
Cluster QE
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-04-15 09:44 EDT by Christine Caulfield
Modified: 2009-04-16 15:59 EDT (History)
1 user (show)

See Also:
Fixed In Version: RHBA-2005-735
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-10-07 12:54:31 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Christine Caulfield 2005-04-15 09:44:15 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050328 Firefox/1.0.2 Fedora/1.0.2-3

Description of problem:
If an error occurs in a dlm_lock() operation done from userspace, the dlm returns an incorrect error code. In fact it often returns just a large random number which the library interprets as a lockID.



Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
Run the following program:

#include <inttypes.h>
#include <sys/types.h>
#include <stdio.h>
#include <errno.h>
#include "libdlm.h"

int main(int argc, char *argv[])
{
    int status;
    int lockid;

    status = lock_resource("LOCKNAME", -1, /* -1 is not a valid lock mode */
                           0, &lockid);

    printf("lock status = %d, errno = %d\n", status, errno);
}


Actual Results:  The program hangs in libdlm waiting for the DLM to deliver an AST which never comes (because the lock call was in error)

Expected Results:  The output:
"lock status = -1, errno = 22"

Additional info:

The following patch fixes it:

diff -u -p -r1.24.2.1 device.c
--- device.c    2 Feb 2005 09:55:08 -0000       1.24.2.1
+++ device.c    15 Apr 2005 13:18:22 -0000
@@ -975,6 +975,9 @@ static int do_user_lock(struct file_info
                           bast_routine : NULL,
                          kparams->range.ra_end ? &kparams->range : NULL);
 
+       if (status)
+               goto out_err;
+
        /* If it succeeded (this far) with a new lock then keep track of
           it on the file's lkb list */
        if (!status && !(kparams->flags & DLM_LKF_CONVERT)) {
Comment 1 Christine Caulfield 2005-04-21 10:03:04 EDT
Fixed on FC4 branch
Comment 2 Christine Caulfield 2005-06-28 08:42:05 EDT
Also now fixed on RHEL4 branch so it should appear in U2
Comment 4 Red Hat Bugzilla 2005-10-07 12:54:31 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2005-735.html

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