Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 154990 - dlm returns incorrect result to userspace on lock error
Summary: dlm returns incorrect result to userspace on lock error
Alias: None
Product: Red Hat Cluster Suite
Classification: Retired
Component: dlm
Version: 4
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Christine Caulfield
QA Contact: Cluster QE
Depends On:
TreeView+ depends on / blocked
Reported: 2005-04-15 13:44 UTC by Christine Caulfield
Modified: 2009-04-16 19:59 UTC (History)
1 user (show)

Fixed In Version: RHBA-2005-735
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2005-10-07 16:54:31 UTC

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2005:735 normal SHIPPED_LIVE dlm-kernel bug fix update 2005-10-07 04:00:00 UTC

Description Christine Caulfield 2005-04-15 13:44:15 UTC
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:

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
+++ 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 14:03:04 UTC
Fixed on FC4 branch

Comment 2 Christine Caulfield 2005-06-28 12:42:05 UTC
Also now fixed on RHEL4 branch so it should appear in U2

Comment 4 Red Hat Bugzilla 2005-10-07 16:54:31 UTC
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.

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