Bug 1319507

Summary: FS corruption when using overlay FS on top of XFS (broken whiteout support)
Product: [Fedora] Fedora Reporter: Seb L. <D8F55524>
Component: kernelAssignee: Miklos Szeredi <mszeredi>
Status: CLOSED INSUFFICIENT_DATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: D8F55524, dhowells, fedora-kernel-xfs, gansalmon, itamar, jonathan, kernel-maint, madhu.chinakonda, mchehab, mszeredi
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-10-26 16:59:08 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 Seb L. 2016-03-20 19:20:48 UTC
Description of problem:
Using overlay FS on top of XFS results in corrupted merged file system due to bad handling of whiteouts.

Version-Release number of selected component (if applicable):
kernel-4.4.5-300.fc23.x86_64

How reproducible:
Always

Steps to Reproduce:
1. mount an overlay FS
2. remove a file present in lowerdir in the merged FS
3. the merged FS is now corrupted

Actual results:
$ mkdir upper lower work merged
$ echo hello > lower/hello.txt
$ sudo mount -t overlay overlay -olowerdir=lower,upperdir=upper,workdir=work merged
$ ls -l merged
total 4
-rw-rw-r--. 1 user user 6 Mar 20 20:00 hello.txt
$ rm merged/hello.txt
$ ls -l merged
ls: cannot access merged/hello.txt: No such file or directory
total 0
?????????? ? ? ? ?            ? hello.txt
$ sudo umount merged

Expected results:
(same commands on tmpfs instead of XFS)
$ mkdir upper lower work merged
$ echo hello > lower/hello.txt
$ sudo mount -t overlay overlay -olowerdir=lower,upperdir=upper,workdir=work merged
$ ls -l merged
total 4
-rw-rw-r--. 1 user user 6 Mar 20 20:01 hello.txt
$ rm merged/hello.txt
$ ls -l merged
total 0
$ sudo umount merged

Additional info:

Comment 1 Miklos Szeredi 2016-06-16 09:41:38 UTC
XFS filesystem needs to be created with "fstype=1" option:

  mkfs.xfs -n fstype=1

Upstream fix to prevent filesystems without fstype to be mounted:

  v4.7-rc1  21765194cecf ("ovl: Do d_type check only if work dir creation was successful")

Comment 2 Laura Abbott 2016-09-23 19:53:15 UTC
*********** MASS BUG UPDATE **************
 
We apologize for the inconvenience.  There is a large number of bugs to go through and several of them have gone stale.  Due to this, we are doing a mass bug update across all of the Fedora 23 kernel bugs.
 
Fedora 23 has now been rebased to 4.7.4-100.fc23.  Please test this kernel update (or newer) and let us know if you issue has been resolved or if it is still present with the newer kernel.
 
If you have moved on to Fedora 24 or 25, and are still experiencing this issue, please change the version to Fedora 24 or 25.
 
If you experience different issues, please open a new bug report for those.

Comment 3 Laura Abbott 2016-10-26 16:59:08 UTC
*********** MASS BUG UPDATE **************
This bug is being closed with INSUFFICIENT_DATA as there has not been a response in 4 weeks. If you are still experiencing this issue, please reopen and attach the relevant data from the latest kernel you are running and any data that might have been requested previously.

Comment 4 Seb L. 2017-11-20 12:54:26 UTC
Confirmed as working in Fedora 25/4.13.10.