Bug 1255512

Summary: With an OverlayFS that has Btrfs as the upper layer, removal of directories silently fails
Product: [Fedora] Fedora Reporter: Neal Gompa <ngompa13>
Component: kernelAssignee: Kernel Maintainer List <kernel-maint>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: dan, dhowells, gansalmon, itamar, jonathan, kernel-maint, madhu.chinakonda, mchehab
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-10-21 20:53:50 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:
Attachments:
Description Flags
Script to reproduce the issue reliably (run as root)
none
strace output for "rm -rf" on a btrfs+tmpfs overlayfs none

Description Neal Gompa 2015-08-20 19:22:33 UTC
Created attachment 1065364 [details]
Script to reproduce the issue reliably (run as root)

Description of problem:
When an OverlayFS is mounted with a Btrfs filesystem as the upper layer and the user attempts to remove a directory in the overlay that exists only in the lower filesystem, the directory whiteout character device is not created in the upper filesystem, nor does the directory appear to be removed in the overlay.

This issue is reproducible regardless of the filesystem type of the lower filesystem, and does not reproduce when other filesystem types such as ext4 are used as the upper filesystem.


Version-Release number of selected component (if applicable):
kernel-4.1.5-200.fc22
kernel-4.0.9-200.fc21

How reproducible:
Always

Steps to Reproduce:
Use attached script as root

Actual results:
Directory "deleted" is still there

Expected results:
Directory "deleted" should be gone

Additional info:
This issue was originally discovered on CentOS 7.1, and reproduced on Fedora (with its kernels) and Arch (with mainline kernels).

Comment 1 Josh Boyer 2015-08-21 14:04:04 UTC
It is almost certainly best to email upstream directly about this issue.

Comment 2 Neal Gompa 2015-08-21 15:37:00 UTC
Who should I contact?

Comment 3 Josh Boyer 2015-08-21 16:08:33 UTC
[jwboyer@lando linux]$ ./scripts/get_maintainer.pl -f fs/overlayfs/
Miklos Szeredi <miklos> (supporter:OVERLAY FILESYSTEM)
linux-unionfs.org (open list:OVERLAY FILESYSTEM)
linux-kernel.org (open list)
[jwboyer@lando linux]$ ./scripts/get_maintainer.pl -f fs/btrfs/
Chris Mason <clm> (maintainer:BTRFS FILE SYSTEM)
Josef Bacik <jbacik> (maintainer:BTRFS FILE SYSTEM)
David Sterba <dsterba> (maintainer:BTRFS FILE SYSTEM)
linux-btrfs.org (open list:BTRFS FILE SYSTEM)
linux-kernel.org (open list)
[jwboyer@lando linux]$ 

You are welcome to CC David Howells and myself if you'd like as well.

Comment 4 Neal Gompa 2015-08-21 18:29:27 UTC
Done.

Comment 5 Dan Fuhry 2015-08-24 14:25:32 UTC
Created attachment 1066408 [details]
strace output for "rm -rf" on a btrfs+tmpfs overlayfs

It looks like unlink("/path/to/dir", AT_REMOVEDIR) returns -EINVAL. The strace output is attached.

Comment 6 Dan Fuhry 2015-08-31 16:01:20 UTC
Update:

Further testing has revealed the following new data:

- The bug also affects ext4 in CentOS's latest 3.10-based kernel, but not 4.x kernels in Fedora or ArchLinux
- The bug also affects xfs in all kernel versions

Comment 7 Justin M. Forbes 2015-10-20 19:37:09 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 22 kernel bugs.

Fedora 22 has now been rebased to 4.2.3-200.fc22.  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 23, and are still experiencing this issue, please change the version to Fedora 23.

If you experience different issues, please open a new bug report for those.

Comment 8 Neal Gompa 2015-10-21 20:25:03 UTC
This issue remains present in kernel 4.2.3-200.fc22.

Comment 9 Josh Boyer 2015-10-21 20:53:50 UTC
If I remember correctly, Miklos pointed out that filesystems need to support RENAME_EXCHANGE and RENAME_WHITEOUT to have overlayfs actually be fully functional.  Btrfs doesn't so overlayfs isn't really expected to work.

I'm ignoring CentOS kernels in this bug.  That should be filed with CentOS.

Closing this bug out as UPSTREAM, as that is where the work needs to be done and the Fedora kernel maintainers are not likely to get around to doing it.