Bug 437416 - dlm_tool lockdump give garbage or no output with large lock counts
dlm_tool lockdump give garbage or no output with large lock counts
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: cman (Show other bugs)
All Linux
low Severity low
: rc
: ---
Assigned To: David Teigland
GFS Bugs
Depends On:
  Show dependency treegraph
Reported: 2008-03-13 18:18 EDT by Dean Jansa
Modified: 2010-01-05 12:49 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2010-01-05 12:49:50 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Dean Jansa 2008-03-13 18:18:36 EDT
Description of problem:

If I create > ~ 2930 locks dlm_tool lockdump  either displays garbage data or
nothing at all.  Releasing some of the locks "fixes" the issue.

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

How reproducible:

Every time

Steps to Reproduce:
1. grab more than 3000 locks
2. dlm_tool lockdump myns
Comment 1 Dean Jansa 2008-03-14 16:19:22 EDT
As Dave suggested, a cat of the _locks file in /sys/kerne/debug/dlm shows the

[root@marathon-01 dlm]# pwd
[root@marathon-01 dlm]# cat default_locks 
cat: default_locks: Cannot allocate memory

If you run dlm_tool lockdump default when the above happens you get:
[root@marathon-01 dlm]# dlm_tool lockdump default
invalid debugfs line 0: id nodeid remid pid xid exflags flags sts grmode rqmode
time_ms r_nodeid r_len r_name

The following patch has dlm_tool report an error of the initial fgets returns an
error rather than printing out either the first line of the file or garbage:

[root@marathon-01 dlm_tool]# ./dlm_tool lockdump default
can't read /sys/kernel/debug/dlm/default_locks: Cannot allocate memory
[root@marathon-01 dlm_tool]# 

--- ../main.c   2008-03-14 14:56:03.000000000 -0500
+++ main.c      2008-03-14 15:16:13.000000000 -0500
@@ -332,7 +332,12 @@
        /* skip the header on the first line */
-       fgets(line, LOCK_LINE_MAX, file);
+       if (!fgets(line, LOCK_LINE_MAX, file)) {
+               if (!feof(file)) {
+                       fprintf(stderr, "can't read %s: %s\n", path,
+               }
+               return;
+       }
        while (fgets(line, LOCK_LINE_MAX, file)) {
                rv = sscanf(line, "%x %d %x %u %llu %x %x %hhd %hhd %hhd %u %d %d",


Comment 2 David Teigland 2010-01-05 12:49:50 EST
The reason I've not done anything with this is that I tested with many times this number of locks and never had a problem dumping them all.  Because this is only a cosmetic issue, it's not worth the effort of getting the patch into RHEL and I'm going to just drop it.

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