Bug 1858535

Summary: btrfs stops incrementing inode version counter after a remount
Product: [Fedora] Fedora Reporter: Eric Sandeen <esandeen>
Component: kernelAssignee: fedora-kernel-btrfs
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: acaringi, airlied, bskeggs, bugzilla, fedoraproject, hdegoede, ichavero, itamar, jarodwilson, jeremy, jforbes, jglisse, john.j5live, jonathan, josef, kernel-maint, lgoncalv, linville, masami256, mchehab, mjg59, steved
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-10-05 04:07:47 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:
Bug Depends On:    
Bug Blocks: 1851166    

Description Eric Sandeen 2020-07-18 22:24:36 UTC
1. Please describe the problem:

btrfs sets SB_I_VERSION by default in btrfs_fill_super() at mount time, which implements inode change counters necessary for proper NFSV4 operation.  (see documentation in include/linux/iversion.h)

However, a remount of a btrfs filesystem loses the flag unless "iversion" is explicitly added to the remount options, and the change counter stops incrementing, which will interfere with proper NFSV4 operations on an exported btrfs filesystem.

2. What is the Version-Release number of the kernel:

kernel-5.8.0-0.rc3.1.fc33

3. Did it work previously in Fedora? If so, what kernel version did the issue
   *first* appear?  Old kernels are available for download at
   https://koji.fedoraproject.org/koji/packageinfo?packageID=8 :

Unknown

4. Can you reproduce this issue? If so, please provide the steps to reproduce
   the issue below:

instrument kernel to show SB_I_VERSION status.  Or, use wireshark etc to trace NFS operations.

Mount a btrfs filesystem, observe SB_I_VERSION is set and/or observe proper version increments over the wire.

mount -o remount the mountpoint, observe no SB_I_VERSION set and/or observe no further increments.

Unfortunately statx does not yet show the version counter and AFAIK there is no btrfs disk debugger which can be used to investigate or demonstrate this behavior.

5. Does this problem occur with the latest Rawhide kernel? To install the
   Rawhide kernel, run ``sudo dnf install fedora-repos-rawhide`` followed by
   ``sudo dnf update --enablerepo=rawhide kernel``:

It occurs with upstream 5.8.0-rc3 so I assume that it does.

6. Are you running any modules that not shipped with directly Fedora's kernel?:

no

7. Please attach the kernel logs. You can get the complete kernel log
   for a boot with ``journalctl --no-hostname -k > dmesg.txt``. If the
   issue occurred on a previous boot, use the journalctl ``-b`` flag.

Output of instrumented kernel with extra printks in show_sb_opts():

[172388.212788] BTRFS: device fsid 3985d580-0145-4685-90d2-0bdd55d63502 devid 1 transid 5 /dev/pmem0p1 scanned by mkfs.btrfs (17535)
[172392.913417] BTRFS info (device pmem0p1): disk space caching is enabled
[172392.920812] BTRFS info (device pmem0p1): has skinny extents
[172392.927147] BTRFS info (device pmem0p1): flagging fs with big metadata feature
[172392.936216] BTRFS info (device pmem0p1): enabling ssd optimizations
[172392.943368] BTRFS info (device pmem0p1): checking UUID tree
[172393.063052] pmem0p1 iversion
<remount>
[172410.834731] BTRFS info (device pmem0p1): disk space caching is enabled
[172410.954965] pmem0p1 no iversion

Comment 1 Chris Murphy 2020-10-05 04:07:47 UTC
Fixed by

commit faa008899a4db21a2df99833cb4ff6fa67009a20
Author: Josef Bacik <josef>
Date:   Thu Jul 30 11:18:09 2020 -0400

    btrfs: make sure SB_I_VERSION doesn't get unset by remount