Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1482542 - gfs2_edit is not saving symlinks
gfs2_edit is not saving symlinks
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: gfs2-utils (Show other bugs)
7.5
Unspecified Unspecified
unspecified Severity medium
: rc
: ---
Assigned To: Andrew Price
cluster-qe@redhat.com
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-08-17 09:51 EDT by Robert Peterson
Modified: 2018-04-10 04:43 EDT (History)
4 users (show)

See Also:
Fixed In Version: gfs2-utils-3.1.10-4.el7
Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of:
Environment:
Last Closed: 2018-04-10 04:43:19 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:0668 None None None 2018-04-10 04:43 EDT

  None (edit)
Description Robert Peterson 2017-08-17 09:51:31 EDT
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 06:01:24 EDT
Upstream patch: https://pagure.io/gfs2-utils/c/1742ab40bfbdc1b411710cb2263460cc43753c51
Comment 5 Justin Payne 2018-01-17 17:34:01 EST
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 04:43:19 EDT
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.