Skip to contentSkip to conversation

45aebeaf4f67 "ovl: Ensure upper filesystem supports d_type" breaking Docker

DISCUSSION Daniel Axtens 5 participants 8 messages May 16, 2016 – May 18, 2016 VFS

lore
Share & tools
lore
#0 lore raw

Hi,

I installed a fresh 4.6.0 kernel on my ppc64le system, and tried to run a docker container. It failed.

Docker gave me errors like this:

docker: Error response from daemon: error creating overlay mount to /var/lib/docker/overlay/2bc07cedad2770da2f384d5c1e81a6f45fa3c44a7658f10d02e5973ef76620fc-init/merged: invalid argument.

In dmesg, I'm seeing:

overlayfs: upper fs needs to support d_type.

Reverting 45aebeaf4f67 ("ovl: Ensure upper filesystem supports d_type") fixes the issue for me. I haven't investigated the root cause yet - at a guess I'd say either Docker's layering system, or some weird interaction with namespacing, maybe? I'll have a look when I get a spare moment.

For reference, I'm using docker 1.11.0-dev.

Regards,
Daniel Axtens

#1 lore raw
Quoted 5 lines · Daniel Axtens

Hi,

I installed a fresh 4.6.0 kernel on my ppc64le system, and tried to run a docker container. It failed.

Quoted 8 lines

Docker gave me errors like this:

docker: Error response from daemon: error creating overlay mount to /var/lib/docker/overlay/2bc07cedad2770da2f384d5c1e81a6f45fa3c44a7658f10d02e5973ef76620fc-init/merged: invalid argument.

In dmesg, I'm seeing:

overlayfs: upper fs needs to support d_type.

Hi Daniel,

What't the underlying fs you are using. overlayfs requires underlying filesystem to support d_type and there were cases where xfs was built with ftype=0 and in that case xfs does not support d_type. That means it led to issues like whiteouts not being recognized and being left behind during various operations.

So it became clear that we need a check at mount time to make sure d_type is supported otherwise error out. This will require users to do mkfs.xfs with ftype=1 to make progress.

I think new defaults for mkfs.xfs are such that ftype=1 is set. I am not sure which version that change was made in.

Thanks
Vivek

Quoted 9 lines

Reverting 45aebeaf4f67 ("ovl: Ensure upper filesystem supports d_type") fixes the issue for me. I haven't investigated the root cause yet - at a guess I'd say either Docker's layering system, or some weird interaction with namespacing, maybe? I'll have a look when I get a spare moment.

For reference, I'm using docker 1.11.0-dev.

Regards,
Daniel Axtens

maintainer
#2 lore raw
Quoted 6 lines · Vivek Goyal

So it became clear that we need a check at mount time to make sure d_type is supported otherwise error out. This will require users to do mkfs.xfs with ftype=1 to make progress.

I think new defaults for mkfs.xfs are such that ftype=1 is set. I am not sure which version that change was made in.

Dumb question - can we end up with empty workdir at that point? Because if we do, the check would appear to return a false negative, no matter what fs supports...

#3 lore raw
Quoted 11 lines · Al Viro
Quoted 6 lines · Vivek Goyal

So it became clear that we need a check at mount time to make sure d_type is supported otherwise error out. This will require users to do mkfs.xfs with ftype=1 to make progress.

I think new defaults for mkfs.xfs are such that ftype=1 is set. I am not sure which version that change was made in.

Dumb question - can we end up with empty workdir at that point? Because if we do, the check would appear to return a false negative, no matter what fs supports...

ovl_workdir_create() creates a subdirectory of workdir ("work") so workdir itself won't be empty after that. If somebody else messes with workdir, then we are screwed anyway.

Thanks,
Miklos

#4 lore raw
Quoted 9 lines · Miklos Szeredi
Quoted 8 lines · Al Viro
Quoted 6 lines · Vivek Goyal

So it became clear that we need a check at mount time to make sure d_type is supported otherwise error out. This will require users to do mkfs.xfs with ftype=1 to make progress.

I think new defaults for mkfs.xfs are such that ftype=1 is set. I am not sure which version that change was made in.

Quoted 7 lines
Quoted 3 lines

Dumb question - can we end up with empty workdir at that point? Because if we do, the check would appear to return a false negative, no matter what fs supports...

ovl_workdir_create() creates a subdirectory of workdir ("work") so workdir itself won't be empty after that. If somebody else messes with workdir, then we are screwed anyway.

Right. Initially I was creating a directory of my own and later realized that ovl_workdir_create() already creates one.

Having said that, what happens when ovl_workdir_create() fails and we mount overlayfs read only. In that case I think we will conclude that underlying fs does not support d_type and mounting will fail.

Any thoughts, on how to handle this failure path better?

Daniel,

Yesterday Eric Sandeen told me that I can run "xfs_info <mount-point>" to figure out if ftype is 0 or 1. You might want to run "xfs_info /" and ensure ftype=0 in your case and overlay is not detecting it wrong.

Thanks
Vivek

#5 lore raw
Quoted 3 lines · Vivek Goyal

Having said that, what happens when ovl_workdir_create() fails and we mount overlayfs read only. In that case I think we will conclude that underlying fs does not support d_type and mounting will fail.

Good point, I missed that.

Quoted 1 line

Any thoughts, on how to handle this failure path better?

Just skip the d_type test. We won't create whiteouts that way (and whiteouts would only have been created with a previous kernel that didn't have this test, which I don't think is a very interesting case).

Thanks,
Miklos

#7 lore raw
In reply to Vivek Goyal

Hi Vivek,

Sorry for the delay in getting back to you.

Quoted 5 lines

What't the underlying fs you are using. overlayfs requires underlying filesystem to support d_type and there were cases where xfs was built with ftype=0 and in that case xfs does not support d_type. That means it led to issues like whiteouts not being recognized and being left behind during various operations.

I'm using ext4 as the backing filesystem for Docker.

However, if I manually mount an overlay directly on the ext4 fs, it works just fine.

Therefore, I suspect the problem arises through some magic Docker is doing. I think it is layering overlays and may be doing that in some weird way.

I'm hopefully going to get some more time to spend on this problem (and on that machine) today. As soon as I can unpick what Docker is doing I'll post more details.

Regards,
Daniel

Quoted 20 lines

So it became clear that we need a check at mount time to make sure d_type is supported otherwise error out. This will require users to do mkfs.xfs with ftype=1 to make progress.

I think new defaults for mkfs.xfs are such that ftype=1 is set. I am not sure which version that change was made in.

Thanks
Vivek

Quoted 9 lines

Reverting 45aebeaf4f67 ("ovl: Ensure upper filesystem supports d_type") fixes the issue for me. I haven't investigated the root cause yet - at a guess I'd say either Docker's layering system, or some weird interaction with namespacing, maybe? I'll have a look when I get a spare moment.

For reference, I'm using docker 1.11.0-dev.

Regards,
Daniel Axtens

#6 lore raw
In reply to Vivek Goyal

Hi Vivek,

My sincere apologies - it turns out I *was* running on xfs with ftype=0. Someone in the office had moved docker's storage without me noticing.

Apologies to all whose time I wasted.

Regards,
Daniel

Quoted 35 lines · Vivek Goyal
Quoted 9 lines · Miklos Szeredi
Quoted 8 lines · Al Viro
Quoted 6 lines · Vivek Goyal

So it became clear that we need a check at mount time to make sure d_type is supported otherwise error out. This will require users to do mkfs.xfs with ftype=1 to make progress.

I think new defaults for mkfs.xfs are such that ftype=1 is set. I am not sure which version that change was made in.

Quoted 7 lines
Quoted 3 lines

Dumb question - can we end up with empty workdir at that point? Because if we do, the check would appear to return a false negative, no matter what fs supports...

ovl_workdir_create() creates a subdirectory of workdir ("work") so workdir itself won't be empty after that. If somebody else messes with workdir, then we are screwed anyway.

Right. Initially I was creating a directory of my own and later realized that ovl_workdir_create() already creates one.

Having said that, what happens when ovl_workdir_create() fails and we mount overlayfs read only. In that case I think we will conclude that underlying fs does not support d_type and mounting will fail.

Any thoughts, on how to handle this failure path better?

Daniel,

Yesterday Eric Sandeen told me that I can run "xfs_info <mount-point>" to figure out if ftype is 0 or 1. You might want to run "xfs_info /" and ensure ftype=0 in your case and overlay is not detecting it wrong.

Thanks
Vivek