Bug 128415

Summary: gnbd_import is not handling /dev/gnbd? device nodes correctly
Product: [Retired] Red Hat Cluster Suite Reporter: Adam "mantis" Manthei <amanthei>
Component: gfsAssignee: Ben Marzinski <bmarzins>
Status: CLOSED CURRENTRELEASE QA Contact: Cluster QE <mspqa-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 3   
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: 2010-10-29 21:49:20 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:

Description Adam "mantis" Manthei 2004-07-22 17:41:42 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7)
Gecko/20040706 Firefox/0.9.1

Description of problem:
gnbd_import doesn't clear out the old devnodes for /dev/gnbd?  so if
the major number changes the next time gnbd_import is called (i.e. the
modules were loaded in a different order) the /dev/gnbd?  nodes are
not rewritten,resulting in a device node that has the wrong major number.

As a side note, the /dev/gnbd? device nodes are also not removed when
the /dev/gnbd/gnbdname nodes are removed.



Version-Release number of selected component (if applicable):
GFS-modules-6.0.0-1.2

How reproducible:
Always

Steps to Reproduce:
1. rm -rf /dev/gnbd*
2. modprobe gnbd
3. gnbd_import -i $servername
4. gnbd_import -R
5. modprobe -r gnbd
6. modprobe pool
7. modprobe gnbd
8. gnbd_import -i $servername
9. /dev/gnbdb will now have the wrong major number
    

Actual Results:  dev/gnbdb will now have the wrong major number

Expected Results:  dev/gnbdb should  have the correct major number

Additional info:

Comment 1 Adam "mantis" Manthei 2004-07-22 17:42:37 UTC
detailed set of steps:


#
# No pool or gnbd in devices (modules not loaded)
#
[root@trin-06 root]# cat /proc/devices
Character devices:
  1 mem
  2 pty
  3 ttyp
  4 ttyS
  5 cua
  7 vcs
 10 misc
 13 input
 29 fb
 36 netlink
128 ptm
129 ptm
130 ptm
131 ptm
132 ptm
133 ptm
134 ptm
135 ptm
136 pts
137 pts
138 pts
139 pts
140 pts
141 pts
142 pts
143 pts
162 raw
180 usb
254 HbaApiDev

Block devices:
  1 ramdisk
  3 ide0
  9 md
 12 unnamed
 14 unnamed
 22 ide1
 38 unnamed
 39 unnamed


#
# Clear out GNBD dev directory
#
[root@trin-06 root]# rm -r /dev/gnbd*

[root@trin-06 root]# modprobe gnbd

#
# Import GNBD devices from server (trin-03)
#
[root@trin-06 root]# gnbd_import -i trin-03
gnbd_import: created directory /dev/gnbd
gnbd_import: created GNBD device "trin-03.lab.msp.redhat.com:crap"
gnbd_import: created GNBD device "trin-03.lab.msp.redhat.com:gnbd1"

[root@trin-06 root]# gnbd_import
Device name : trin-03.lab.msp.redhat.com:crap
----------------------
    Minor # : 1
  Proc name : gnbdb
         IP : 192.168.44.173
       Port : 14243
      State : Close Disconnected Clear
   Readonly : No

Device name : trin-03.lab.msp.redhat.com:gnbd1
----------------------
    Minor # : 2
  Proc name : gnbdc
         IP : 192.168.44.173
       Port : 14243
      State : Close Disconnected Clear
   Readonly : No

#
# Proc major numbers match up with device major numbers
#
[root@trin-06 root]# cat /proc/partitions
major minor  #blocks  name     rio rmerge rsect ruse wio wmerge wsect wuse
running use aveq

 254     1        500 gnbdb 0 0 0 0 0 0 0 0 0 0 0
 254     2  524287992 gnbdc 0 0 0 0 0 0 0 0 0 0 0
   3     0   39082680 hda 2141 7383 71770 16370 28656 13749 339368 121410
4294967265 8799380 29938780
   3     1     104391 hda1 37 223 520 280 19 9 56 120 0 270 400
   3     2    1020127 hda2 19 61 232 100 0 0 0 0 0 100 100
   3     3   37953562 hda3 2023 6757 70210 15620 28637 13740 339312
121290 0
16370 136910

[root@trin-06 root]# ls -l /dev/gnbd*
brw-r--r--    1 root     root     254,   1 Jul 22 10:13 /dev/gnbdb
brw-r--r--    1 root     root     254,   2 Jul 22 10:13 /dev/gnbdc
brw-r--r--    1 root     root     254,   0 Jul 22 10:13 /dev/gnbdcomm

/dev/gnbd:
total 0
brw-r--r--    1 root     root     254,   1 Jul 22 10:13
trin-03.lab.msp.redhat.com:crap
brw-r--r--    1 root     root     254,   2 Jul 22 10:13
trin-03.lab.msp.redhat.com:gnbd1

#
# unload
#
[root@trin-06 root]# gnbd_import -R
gnbd_import: removed GNBD device "trin-03.lab.msp.redhat.com:crap"
gnbd_import: removed GNBD device "trin-03.lab.msp.redhat.com:gnbd1"
[root@trin-06 root]# modprobe -r gnbd

#
# loading pool first causes pool to get the major number 254, so GNBD will
# get 253
#
[root@trin-06 root]# modprobe pool
[root@trin-06 root]# lsmod
Module                  Size  Used by    Not tainted
pool                   83552   0  (unused)
autofs                 13364   0  (autoclean) (unused)
e1000                  75936   1
microcode               5848   0  (autoclean)
gfs                   289384   0  (autoclean)
lock_harness            3276   0  (autoclean) [gfs]
keybdev                 2976   0  (unused)
mousedev                5524   0  (unused)
hid                    22244   0  (unused)
input                   5920   0  [keybdev mousedev hid]
usb-uhci               26412   0  (unused)
usbcore                79328   1  [hid usb-uhci]
ext3                   88168   2
jbd                    52400   2  [ext3]
qla2300               311612   0  (unused)
sd_mod                 13648   0  (unused)
scsi_mod              110120   2  [qla2300 sd_mod]

[root@trin-06 root]# cat /proc/devices
Character devices:
  1 mem
  2 pty
  3 ttyp
  4 ttyS
  5 cua
  7 vcs
 10 misc
 13 input
 29 fb
 36 netlink
128 ptm
129 ptm
130 ptm
131 ptm
132 ptm
133 ptm
134 ptm
135 ptm
136 pts
137 pts
138 pts
139 pts
140 pts
141 pts
142 pts
143 pts
162 raw
180 usb
254 HbaApiDev

Block devices:
  1 ramdisk
  3 ide0
  9 md
 12 unnamed
 14 unnamed
 22 ide1
 38 unnamed
 39 unnamed
254 pool

[root@trin-06 root]# modprobe gnbd
[root@trin-06 root]# cat /proc/devices
Character devices:
  1 mem
  2 pty
  3 ttyp
  4 ttyS
  5 cua
  7 vcs
 10 misc
 13 input
 29 fb
 36 netlink
128 ptm
129 ptm
130 ptm
131 ptm
132 ptm
133 ptm
134 ptm
135 ptm
136 pts
137 pts
138 pts
139 pts
140 pts
141 pts
142 pts
143 pts
162 raw
180 usb
254 HbaApiDev

Block devices:
  1 ramdisk
  3 ide0
  9 md
 12 unnamed
 14 unnamed
 22 ide1
 38 unnamed
 39 unnamed
253 gnbd
254 pool
[root@trin-06 root]# ls -l /dev/gnbd*
brw-r--r--    1 root     root     254,   1 Jul 22 10:13 /dev/gnbdb
brw-r--r--    1 root     root     254,   2 Jul 22 10:13 /dev/gnbdc
brw-r--r--    1 root     root     254,   0 Jul 22 10:13 /dev/gnbdcomm

/dev/gnbd:
total 0
[root@trin-06 root]# gnbd_import -i trin-03
gnbd_import: created GNBD device "trin-03.lab.msp.redhat.com:crap"
gnbd_import: created GNBD device "trin-03.lab.msp.redhat.com:gnbd1"

#
# List device nodes for GNBD.  Note that named nodes have the correct
major
# number 253.
# The generic node names are still the old value 254.
#
[root@trin-06 root]# ls -l /dev/gnbd*
brw-r--r--    1 root     root     254,   1 Jul 22 10:13 /dev/gnbdb
brw-r--r--    1 root     root     254,   2 Jul 22 10:13 /dev/gnbdc
brw-r--r--    1 root     root     253,   0 Jul 22 10:14 /dev/gnbdcomm

/dev/gnbd:
total 0
brw-r--r--    1 root     root     253,   1 Jul 22 10:14
trin-03.lab.msp.redhat.com:crap
brw-r--r--    1 root     root     253,   2 Jul 22 10:14
trin-03.lab.msp.redhat.com:gnbd1

[root@trin-06 root]# cat /proc/partitions
major minor  #blocks  name     rio rmerge rsect ruse wio wmerge wsect wuse
running use aveq

 253     1        500 gnbdb 0 0 0 0 0 0 0 0 0 0 0
 253     2  524287992 gnbdc 0 0 0 0 0 0 0 0 0 0 0
   3     0   39082680 hda 2141 7383 71770 16370 29833 14314 353312 121410
4294967265 8884820 27290140
   3     1     104391 hda1 37 223 520 280 19 9 56 120 0 270 400
   3     2    1020127 hda2 19 61 232 100 0 0 0 0 0 100 100
   3     3   37953562 hda3 2023 6757 70210 15620 29814 14305 353256
121290 0
16370 136910

[root@trin-06 root]# gnbd_import
Device name : trin-03.lab.msp.redhat.com:crap
----------------------
    Minor # : 1
  Proc name : gnbdb
         IP : 192.168.44.173
       Port : 14243
      State : Close Disconnected Clear
   Readonly : No

Device name   Proc name : gnbdc
         IP : 192.168.44.173
       Port : 14243
      State : Close Disconnected Clear
   Readonly : No








Comment 2 Ben Marzinski 2004-07-27 21:08:52 UTC
Added checking in the code, so that the /dev/gnbd<letter> files have
their major number verified.

Comment 3 David Lawrence 2006-07-18 03:56:32 UTC
QA_READY has been deprecated in favor of ON_QA. Please use ON_QA in the future.
Moving to ON_QA.

Comment 5 Lon Hohberger 2010-10-29 21:49:20 UTC
This bugzilla is reported to have been fixed years ago.