Bug 157526

Summary: partition_uuid of devlabel-0.48.03-6 displays diffrent partition uuid for ocfs partitions.
Product: Red Hat Enterprise Linux 3 Reporter: Santosh Singh <santosh.singh3>
Component: devlabelAssignee: Karel Zak <kzak>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: benl, rick.beldin
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard: NdRvw
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-01-10 20:01:36 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:
Bug Depends On:    
Bug Blocks: 190430    
Attachments:
Description Flags
patch to the partition_uuid.c
none
patch to the linux_fs.h file for ocfs support none

Description Santosh Singh 2005-05-12 11:15:38 UTC
Description of problem:
partition_uuid of devlabel-0.48.03-6 displays diffrent partition uuid for ocfs 
partitions.

Version-Release number of selected component (if applicable):
devlabel-0.48.03-6 on RHEL3.0 U4 2.4.21-27.ELsmp i686 i386 GNU/Linux

How reproducible:
Install ocfstools

Steps to Reproduce:

1.Create a partition. 
2.Format this partition with ocfstool.
3.run partition_uuid partition_name
4.repeate step 3 for the same partition,
 will shows diffrent partition uuids for same ocfs partition.
  
Actual results:

partition_uuid displays diffrent uuid for same ocfs partition or displays all 
zeroes as uuid.

Expected results:
Always display the unique partition id for ocfs partition.

Additional info:

Since these structures in linux_fs.h  
struct ocfs_volume_header {
        u_char  minor_version[4];
        u_char  major_version[4];
        u_char  signature[128];
};

struct ocfs_volume_label {
        u_char  disk_lock[48];
        u_char  label[64];
        u_char  label_len[2];
};

 does not have uuid field, the function  get_label_uuid() does not uses it and 
thus displays only all zeroes or some other junk values.

Comment 1 Santosh Singh 2005-05-16 07:17:50 UTC
   Since the partition_uuid utility was not picking up the volume id from the 
quorum space of the volume, which is second sector of the volume. By  adding 
the following field in the structure ocfs_volume_label in linux_fs.h and then 
copying the vol_id into the uuid in the file partition_uuid.c  will solve this 
bug.

Changes
1. In linux_fs.h

struct ocfs_volume_label {
        u_char  disk_lock[48];
        u_char  label[64];
        u_char  label_len[2];
        u_char  vol_id[16];
        u_char  vol_id_len[2];
};
2. In partition_uuid.c
 if (lseek(fd, 0, SEEK_SET) == 0
            && read(fd, (char *) &ovh, sizeof(ovh)) == sizeof(ovh)
            && (strncmp(ovh.signature, OCFS_MAGIC, sizeof(OCFS_MAGIC)) == 0)
            && (lseek(fd, 512, SEEK_SET) == 512)
            && read(fd, (char *) &olbl, sizeof(olbl)) == sizeof(olbl)) {
                uuid[0] = '\0';

Added ===>  memcpy(uuid, olbl.vol_id, sizeof(olbl.vol_id));

            namesize = ocfslabellen(olbl);
             if ((*label = calloc(namesize + 1, 1)) != NULL)
                       memcpy(*label, olbl.label, namesize);
                rv = 0;
        }



Comment 10 Rick Beldin 2006-11-09 13:51:46 UTC
Created attachment 140768 [details]
patch to the partition_uuid.c

Comment 11 Rick Beldin 2006-11-09 13:56:52 UTC
Created attachment 140769 [details]
patch to the linux_fs.h file for ocfs support

Comment 12 Rick Beldin 2006-11-09 14:06:59 UTC
patches above appear to work in very limited testing. 

Comment 13 Daniel Riek 2006-12-16 22:35:43 UTC
As the RHEL 3.9 release will be very constraint, we need a better understanding
of the functional impact of the problem. Is that the only way to find out the
UUIDs? Any workarounts?

Comment 15 RHEL Program Management 2007-01-10 20:01:36 UTC
Product Management has reviewed and declined this request.  You may appeal this
decision by reopening this request.