Shiftfs not keeping directories in sync?

I’ve been running a development environment in an Ubuntu 18.04 container, sharing a directory on my host with it. I have noticed that edits on either side aren’t always kept in sync (even for prolonged durations), which of course can create chaotic scenarios. Leaving and restarting the container causes the sync to happen from the looks of it.

My container config is:

shared-dir:
  path: /srv/web/my-project
  shift: "true"
  source: /home/adrian/code/my-project
  type: disk

Alas, I need write capability on both sides so a read-only mount is not an option. Has anyone observed similar issues?

There was a VFS cache issue in the kernel code which I believe @brauner has since corrected, this was causing not only issues like you described but also double counting of disk usage on zfs.

@brauner or @sforshee should be able to point to what kernel has the needed fixes.

The needed fix is:
https://kernel.ubuntu.com/git/ubuntu/ubuntu-eoan.git/commit/?id=5995fd706bb22d325a5c8db315213ac14e0b7eb0
which is in Eoan but not in Disco afaict.

The commit is in kernel 5.0.0-32.34 in disco-proposed.

Note though that making modifications to the “lower” filesystem while shiftfs is mounted over it is not supported. It might appear to be work sometimes, but you’ll likely run into problems sooner or later. This is the case with all “stacked” filesystems such as overlayfs.

Thanks for the response guys!

Note though that making modifications to the “lower” filesystem while shiftfs is mounted over it is not supported.

Ah, I wasn’t aware of that. “lower” meaning the original source dir (looking at my example) or the path mount inside the container?

Ah, I wasn’t aware of that. “lower” meaning the original source dir (looking at my example) or the path mount inside the container?

By “lower” I meant the original source directory.

Ok, got it! That sufficiently explains the issues that prompted me to start this topic.