Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1867474

Summary: [xfs_db] -c 'type inode' may change the current inode number
Product: Red Hat Enterprise Linux 8 Reporter: JianHong Yin <jiyin>
Component: xfsprogsAssignee: Bill O'Donnell <billodo>
Status: CLOSED ERRATA QA Contact: Zorro Lang <zlang>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.3CC: billodo, xzhou, zlang
Target Milestone: rcKeywords: Triaged
Target Release: 8.4Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 15:07:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description JianHong Yin 2020-08-10 06:25:19 UTC
Description of problem:

[root@rhel-8-3-latest ~]# ls -li original-ks.cfg
25169311 -rw-------. 1 root root 6318 Aug  7 21:36 original-ks.cfg
[root@rhel-8-3-latest ~]# xfs_db -r /dev/vda3 -c inode\ 25169311 -c type\ inode -c print | grep core.size
core.size = 2


Version-Release number of selected component (if applicable):
[root@rhel-8-3-latest ~]# rpm -q xfsprogs
xfsprogs-5.0.0-4.el8.x86_64

How reproducible:
always

Steps to Reproduce:
1. xfs_db -r /dev/vda3 -c inode\ 25169311 -c type\ inode -c print | grep core.size
2. check if the file size is right

Actual results:
get wrong file size

Expected results:
get real file size

Additional info:
 if remove the  "-c 'type inode'"  it works file.

'''
[root@rhel-8-3-latest ~]# xfs_db -r /dev/vda3 -c inode\ 25169311 -c type\ inode -c print | grep core.size
core.size = 2
[root@rhel-8-3-latest ~]# xfs_db -r /dev/vda3 -c inode\ 25169311 -c print | grep core.size
core.size = 6318
'''

Comment 1 Zorro Lang 2020-08-10 09:10:42 UTC
Thanks for this reporting. That's strange, the offset is changed after "type inode":

# xfs_db -c "inode 133" -c "addr" -c "p core.size" -c "type inode" -c "addr" -c "p core.size" /dev/mapper/testvg-scratchdev
current
        byte offset 68096, length 512
        buffer block 128 (fsbno 16), 32 bbs
        inode 133, dir inode -1, type inode
core.size = 123142
current
        byte offset 65536, length 512
        buffer block 128 (fsbno 16), 32 bbs
        inode 128, dir inode 128, type inode
core.size = 42

Comment 2 JianHong Yin 2020-08-10 09:43:35 UTC
(In reply to Zorro Lang from comment #1)
> Thanks for this reporting. That's strange, the offset is changed after "type
> inode":
> 
> # xfs_db -c "inode 133" -c "addr" -c "p core.size" -c "type inode" -c "addr"
> -c "p core.size" /dev/mapper/testvg-scratchdev
> current
>         byte offset 68096, length 512
>         buffer block 128 (fsbno 16), 32 bbs
>         inode 133, dir inode -1, type inode
                     ^^^^^^^^^^^^ and is this expected? (dir inode is negative?)

> core.size = 123142
> current
>         byte offset 65536, length 512
>         buffer block 128 (fsbno 16), 32 bbs
>         inode 128, dir inode 128, type inode
> core.size = 42

Comment 3 Eric Sandeen 2020-08-12 17:35:20 UTC
So: it's not that the size is incorrectly reported; xfs_db is reporting on a /different/ inode after the "type inode" command.

Comment 4 Eric Sandeen 2020-08-12 17:37:44 UTC
This is strange behavior; it has to do with the validator needing to change the disk address in order to validate the entire inode chunk, I think.

xfs_db> inode 132
xfs_db> inode
current inode number is 132
xfs_db> daddr
current daddr is 132

xfs_db> type inode
xfs_db> inode
current inode number is 128
xfs_db> daddr
current daddr is 128

Comment 5 Eric Sandeen 2020-08-12 18:06:24 UTC
The simplest solution is probably to just make type_f() a no-op if the current type is the same as the requested type.

Comment 11 errata-xmlrpc 2021-05-18 15:07:52 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 (xfsprogs bug fix and enhancement update), 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-2021:1690