RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1482542 - gfs2_edit is not saving symlinks
Summary: gfs2_edit is not saving symlinks
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: gfs2-utils
Version: 7.5
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Andrew Price
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-08-17 13:51 UTC by Robert Peterson
Modified: 2018-04-10 08:43 UTC (History)
4 users (show)

Fixed In Version: gfs2-utils-3.1.10-4.el7
Doc Type: No Doc Update
Doc Text:
undefined
Clone Of:
Environment:
Last Closed: 2018-04-10 08:43:19 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:0668 0 None None None 2018-04-10 08:43:30 UTC

Description Robert Peterson 2017-08-17 13:51:31 UTC
Description of problem:
I got a set of GFS2 metadata from a customer, only to discover
the symlinks were all blank. That's because in gfs2_edit's
savemeta.c function get_gfs_struct_info it has:

(After a special case for saving directories)
		else if (!inode->i_di.di_height && !block_is_systemfile(owner) &&
			 !S_ISDIR(inode->i_di.di_mode))
			*gstruct_len = sizeof(struct gfs2_dinode);

So savemeta should also save the full contents for symlinks.
In this case, we can simply add something like:

              && !S_ISLNK(inode->i_di.di_mode))

Or some such.

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


How reproducible:
Always

Steps to Reproduce:
1.ln -s /etc/fstab /mnt/gfs2/my_symlink
2.umount /mnt/gfs2
3.gfs2_edit savemeta <dev>
4.gfs2_edit restoremeta <dev>

Actual results:
Restored symlink has empty/zeroed contents.

Expected results:
Symlinks should be preserved for file system analysis.

Additional info:

Comment 2 Andrew Price 2017-08-18 10:01:24 UTC
Upstream patch: https://pagure.io/gfs2-utils/c/1742ab40bfbdc1b411710cb2263460cc43753c51

Comment 5 Justin Payne 2018-01-17 22:34:01 UTC
Verified in gfs2-utils-3.1.10-6.el7:

[root@host-002 ~]# rpm -q gfs2-utils
gfs2-utils-3.1.10-6.el7.x86_64
[root@host-002 ~]# mkfs.gfs2 -p lock_nolock -O -j1 /dev/mapper/testvg1-testlv1
It appears to contain an existing filesystem (gfs2)
/dev/mapper/testvg1-testlv1 is a symbolic link to /dev/dm-2
This will destroy any data on /dev/dm-2
Discarding device contents (may take a while on large devices): Done
Adding journals: Done 
Building resource groups: Done 
Creating quota file: Done
Writing superblock and syncing: Done
Device:                    /dev/mapper/testvg1-testlv1
Block size:                4096
Device size:               1.99 GB (522240 blocks)
Filesystem size:           1.99 GB (522239 blocks)
Journals:                  1
Resource groups:           9
Locking protocol:          "lock_nolock"
Lock table:                ""
UUID:                      c906db4c-0877-4c64-8b0f-a3b4f60d600a
[root@host-002 ~]# mount -tgfs2 /dev/mapper/testvg1-testlv1 /mnt/gfs2/
[root@host-002 ~]# ln -s /etc/fstab /mnt/gfs2/my_symlink
[root@host-002 ~]# umount /mnt/gfs2
[root@host-002 ~]# gfs2_edit savemeta /dev/mapper/testvg1-testlv1
There are 522239 blocks of 4096 bytes in the filesystem.
Filesystem size: 1.1015GB
522239 blocks processed, 33139 saved (100%)

Metadata saved to file /tmp/gfsmeta.tsx8Rx (gzipped, level 9).
[root@host-002 ~]# gfs2_edit restoremeta /tmp/gfsmeta.tsx8Rx /dev/mapper/testvg1-testlv1
Metadata saved at Wed Jan 17 16:30:33 2018
File system size 1.1015GB
Block size is 4096B
This is gfs2 metadata.
There are 522240 free blocks on the destination device.
Highest saved block is 461070 (0x7090e)
461071 blocks processed, 33139 saved (100%)
File /tmp/gfsmeta.tsx8Rx restore successful.
[root@host-002 ~]# mount -tgfs2 /dev/mapper/testvg1-testlv1 /mnt/gfs2/
[root@host-002 ~]# ls -alt /mnt/gfs2/my_symlink 
lrwxrwxrwx. 1 root root 10 Jan 17 16:30 /mnt/gfs2/my_symlink -> /etc/fstab

Comment 9 errata-xmlrpc 2018-04-10 08:43:19 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:0668


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