Skip to content

overlayfs: Can't delete file moved from base layer to newly created dir even on ext4 #9572

Closed

Description

@overplumbum

I'm testing overlayfs with docker from master branch 58ce014 ( https://master.dockerproject.com/ ):

Server version: 1.3.2-dev
Server API version: 1.16
Go version (server): go1.3.3
Git commit (server): 58ce014

On Ubuntu:14.04 with 3.18 kernel from vivid ( http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.18-vivid/ )

Linux 3.18.0-031800-generic #201412071935 SMP Mon Dec 8 00:36:34 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
# docker -D info
Containers: 51
Images: 169
Storage Driver: overlay
Execution Driver: native-0.2
Kernel Version: 3.18.0-031800-generic
Operating System: Ubuntu 14.04.1 LTS
Debug mode (server): false
Debug mode (client): true
Fds: 10
Goroutines: 13
EventsListeners: 0
Init Path: /usr/local/bin/docker-1.3.2-dev
WARNING: No swap limit support

With graph stored on EXT4 partition using overlay(fs) storage backend.

To reproduce issue one should:

  • create new dir
  • move some file from base layer to this new dir
  • remove this file from it's new location (no error message here)
  • check if it is still there (file transforms to some kind of character device)

Snippet to reproduce:

$ docker run busybox sh -xec 'mkdir /foo ; mv /bin/false /foo ; rm -v /foo/false ; ls -l /foo ; rmdir /foo'
+ mkdir /foo
+ mv /bin/false /foo
+ rm -v /foo/false
+ ls -l /foo
total 0
c---------    1 root     root        0,   0 Dec  8 22:51 false
+ rmdir /foo
rmdir: '/foo': Directory not empty

Activity

  1. changed the title [-]overlayfs: Can't delete file moved from upper layer to newly created dir even on ext4[/-] [+]overlayfs: Can't delete file moved from base layer to newly created dir even on ext4[/+] on Dec 8, 2014
  2. jessfraz commented on Dec 9, 2014

    @jessfraz
    Contributor

    Trying this now

    On Monday, December 8, 2014, Denis Orlikhin [email protected]
    wrote:

    I'm testing overlayfs with docker from master branch 58ce014
    58ce014
    ( https://master.dockerproject.com/ ):

    Server version: 1.3.2-dev
    Server API version: 1.16
    Go version (server): go1.3.3
    Git commit (server): 58ce014

    On Ubuntu:14.04 with 3.18 kernel from vivid (
    http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.18-vivid/ )

    Linux 3.18.0-031800-generic #201412071935 SMP Mon Dec 8 00:36:34 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

    docker -D info

    Containers: 51
    Images: 169
    Storage Driver: overlay
    Execution Driver: native-0.2
    Kernel Version: 3.18.0-031800-generic
    Operating System: Ubuntu 14.04.1 LTS
    Debug mode (server): false
    Debug mode (client): true
    Fds: 10
    Goroutines: 13
    EventsListeners: 0
    Init Path: /usr/local/bin/docker-1.3.2-dev
    WARNING: No swap limit support

    With graph stored on EXT4 partition using overlay(fs) storage backend.

    To reproduce issue one should:

    • create new dir
    • move some file from upper layer to this new dir
    • remove this file from it's new location (no error message here)
    • check if it is still there (file transforms to some kind of
      character device)

    Snippet to reproduce:

    $ docker run busybox sh -xec 'mkdir /foo ; mv /bin/false /foo ; rm -v /foo/false ; ls -l /foo ; rmdir /foo'

    • mkdir /foo
    • mv /bin/false /foo
    • rm -v /foo/false
    • ls -l /foo
      total 0
      c--------- 1 root root 0, 0 Dec 8 22:51 false
    • rmdir /foo
      rmdir: '/foo': Directory not empty

    —
    Reply to this email directly or view it on GitHub
    #9572.

  3. snnn commented on Feb 5, 2015

    @snnn

    I can reproduce this bug on Fedora 21.
    Docker version: docker-io-1.4.1-8.fc21.x86_64
    Kernel version: Linux xxxxx 3.18.3-201.fc21.x86_64 #1 SMP Mon Jan 19 15:59:31 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

  4. added
    kind/bug
    and removed on Mar 21, 2015
  5. ctapan commented on Mar 24, 2015

    @ctapan

    I am not able to reproduce this issue on Ubuntu with older "overlayfs" driver and docker 1.4.1.
    3.13.0-44-generic 73-Ubuntu SMP Tue Dec 16 00:22:43 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

    Can someone paste the output for following?
    ls -lah /var/lib/docker/overlay//upper/
    ls -lah /var/lib/docker/overlay//upper/foo/
    ls -lah /var/lib/docker/overlay//upper/bin/

    (Maybe with latest "overlay" driver, last directory might be in /work/)

    Just trying to understand if this is overlay issue or chroot. Most likely will be overlay driver. Sorry I do not have the latest kernel version to try.

  6. sgirones commented on Apr 14, 2015

    @sgirones

    Reproduced:

    $  docker run busybox sh -xec 'mkdir /foo ; mv /bin/false /foo ; rm -v /foo/false ; ls -l /foo ; rmdir /foo'
    + mkdir /foo
    + mv /bin/false /foo
    + rm -v /foo/false
    + ls -l /foo
    total 0
    c---------    1 root     root        0,   0 Apr 14 11:00 false
    + rmdir /foo
    rmdir: '/foo': Directory not empty
    
    $ uname -a
    Linux product-builder-1 3.18.11-031811-generic #201504041535 SMP Sat Apr 4 19:37:40 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
    
    $ docker info
    Containers: 4
    Images: 136
    Storage Driver: overlay
     Backing Filesystem: extfs
    Execution Driver: native-0.2
    Kernel Version: 3.18.11-031811-generic
    Operating System: Ubuntu 14.04.2 LTS
    CPUs: 2
    Total Memory: 23.95 GiB
    Name: product-builder-1
    ID: GCJZ:YZXU:2V74:NNEE:UUXB:BOC6:LNNC:EELA:C2P6:4DEO:3SJE:N2NZ
    WARNING: No swap limit support
    
  7. sgirones commented on Apr 14, 2015

    @sgirones

    Reproduced even with 4.0.0. But behavior was slightly different:

    $ uname -a
    Linux product-builder-1 4.0.0-040000-generic #201504121935 SMP Sun Apr 12 23:36:33 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
    
    $ docker run busybox sh -xec 'mkdir /foo ; mv /bin/false /foo ; rm -v /foo/false ; ls -l /foo ; rmdir /foo'
    + mkdir /foo
    + mv /bin/false /foo
    + rm -v /foo/false
    + ls -l /foo
    ls: /foo/false: No such file or directory
    total 0
    
  8. sgirones commented on Apr 14, 2015

    @sgirones
  9. davebirch commented on May 26, 2015

    @davebirch

    As an additional piece of potentially useful info, I'm seeing this same issue when using pure lxc with an overlayfs filesystem.

    If I delete a file from the lower filesystem, the file is not removed but becomes highlighted as if it's a broken symlink. Trying to read the file results in a "No such file or directory" error.

    Current versions:
    Linux testcontainer 3.13.0-52-generic #85-Ubuntu SMP Wed Apr 29 16:44:17 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

    LXC versions 1.0.7 & 1.1.2

    After doing some testing on a couple of different machines, I discovered that this problem occurs on one box I have where the host filesystem is formatted to xfs, but does not occur on my local machine here the / filesystem is formatted to ext4

  10. darlingm commented on Jun 8, 2015

    @darlingm

    EDIT: FWIW, on Fedora 22 (kernel 4.0.4-303.fc22.x86_64), I CAN reproduce this bug using overlay and chroot. (I'm not running lxc or docker.) ls -la /foo shows:

    ls: cannot access foo/false: No such file or directory
    total 0
    c????????? ? ? ? ?            ? false
    

    And rmdir foo shows: "rmdir: failed to remove 'foo': Directory not empty"

  11. 8 remaining items

  12. mishak87 commented on Jan 7, 2016

    @mishak87
    Contributor

    I have same issue on Linux 1568a0a4bee9 4.2.0-23-generic #28-Ubuntu using ext4.

  13. b-a-t commented on Feb 2, 2016

    @b-a-t

    I've experienced the same problem on Debian 4.3.3-7~bpo8+1 (2016-01-19) kernel with xfs storage backstore for overlay FS. Re-formatting it to ext4 with extra-high i-nodes number seems, solved the problem.

  14. koct9i commented on Mar 14, 2016

    @koct9i

    Fixed in linux 4.5 https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=45d11738969633ec07ca35d75d486bf2d8918df6 going to be backported into next 4.4.y and other stable brances. Simple test sequence in commit message.

  15. thaJeztah commented on Mar 14, 2016

    @thaJeztah
    Member

    Thanks for the heads up @koct9i

  16. mountkin commented on May 9, 2016

    @mountkin
    Contributor

    I came across a similar but different problem with overlay+xfs on kernel 4.5.3
    After deleting a file in the merged directory, ls the file in the merged directory showing all the file attributes as question mark. The file in the upper directory turn out to be a character device.

    3

  17. koct9i commented on May 9, 2016

    @koct9i

    @runcom Nope, this is different bug. That you're linked was fixed in 4.5 https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=45d11738969633ec07ca35d75d486bf2d8918df6 see my comments above

    @mountkin this is completely wrong place for reporting linux kernel bugs
    Please submit this into https://bugzilla.kernel.org and/or lkml and related mailing list.

    I cannot reproduce this right now in 4.4.8+ext4, I'll try exact setup later.

  18. mountkin commented on May 9, 2016

    @mountkin
    Contributor

    Thanks a lot @runcom
    The difference between my report and http://article.gmane.org/gmane.linux.file-systems.union/496 is that I don't need to move the file to a sub directory.

    @koct9i I'm testing with xfs, not ext4. Let me make some noise on the kernel bugzilla then 😇

    Edit: After searching the kernel bugzilla I got this one https://bugzilla.kernel.org/show_bug.cgi?id=108811 , which is exactly the problem I encountered.

  19. koct9i commented on May 10, 2016

    @koct9i

    @mountkin (I haven't found your ticket in bugzilla so I leave it here)
    linux 4.6 fails to mount overlayfs if upperdir points to xfs created without ftype=1 and prints this "overlayfs: upper fs needs to support d_type.". I guess your xfs was created without this feature.

    related commit https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=45aebeaf4f67468f76bedf62923a576a519a9b68

  20. dmcgowan commented on May 10, 2016

    @dmcgowan
    Member

    @koct9i thanks for pointing this out. The fix has also been release in 4.4.6 (changelog https://www.kernel.org/pub/linux/kernel/v4.x/ChangeLog-4.4.6). Going to close this issue now.

  21. added a commit that references this issue on Mar 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/kernelarea/storage/overlayexp/expertkind/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions