← Back to team overview

kernel-packages team mailing list archive

[Bug 1479468] Re: OverlayFS: Wrong mnt_id and path reported in /proc


I posted these patches to the kernel team ML. I've tested the above
reproducer script and it does indeed fix the issue, and in addition I've
ran the unionmount-testsuite 'sudo ./run --ov' on the new kernel and no
regressions were noticed (all test passing).

You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.

  OverlayFS: Wrong mnt_id and path reported in /proc

Status in linux package in Ubuntu:
Status in linux source package in Vivid:

Bug description:
  SRU Justification:


  I am running Ubuntu Vivid (3.19.0-22-generic #22-Ubuntu SMP Tue Jun 16
  17:15:15 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux).  There are two
  issues in OverlayFS as follows:

   1. /proc/<pid>/fdinfo/<fd> reports wrong mnt_id (non-existent in

   2. /proc/<pid>/fd/<fd> shows incorrect path for the symlink target


  These problems can be easily reproduced with the shell script below.
  Fortunately, both problems have been fixed in the upstream's master
  branch of the kernel via the following commits:

      torvalds 4.0:   155e35d4d VFS: Introduce inode-getting helpers for
  layered/unioned fs environments (this is already in ubuntu-vivid)

      torvalds 4.0:   df1a085af VFS: Add a fallthrough flag for marking virtual dentries
      torvalds 4.2-rc2:   f25801ee4 overlay: Call ovl_drop_write() earlier in ovl_dentry_open()
      torvalds 4.2-rc2:   4bacc9c92 overlayfs: Make f_path always point to the overlay and f_inode to the underlay
      torvalds 4.2-rc2:   9391dd00d fix a braino in ovl_d_select_inode()

  (The commit df1a085af may technically not be needed but it prevents a
  conflict when applying 4bacc9c92.)

  [Test Case]

  Simple script to reproduce the problem:


  set -eu


  setup() {
   start_python > /dev/null 2>&1 &
   PYTHON_PID=$(ps -C python | awk '/python/ { print $1 }')
   sleep 1

  setup_mount() {
   mkdir overlay_test
   cd overlay_test
   mkdir a b c z
   sudo mount -t overlay -o lowerdir=a,upperdir=b,workdir=c overlayfs z

  start_python() {
   python << EOF
  import time
  fd = open("z/file", "w")

  check_path() {
   if ! ls -l /proc/$PYTHON_PID/fd | grep -qw "$WD/z/file"; then
    echo "ERROR! expected $WD/z/file"
    set -x
    ls -l /proc/$PYTHON_PID/fd
    set +x

  check_mnt_id() {
   FDINFO_MNT_ID=$(awk '/mnt_id:/ { print $2 }' /proc/$PYTHON_PID/fdinfo/3)
   MOUNTINFO_MNT_ID=$(awk '/overlayfs/ { print $1 }' /proc/self/mountinfo)
   if [[ $FDINFO_MNT_ID -ne $MOUNTINFO_MNT_ID ]]; then
    echo "ERROR! mnt_id $FDINFO_MNT_ID not in /proc/self/mountinfo"
    set -x
    cat /proc/$PYTHON_PID/fdinfo/3
    cat /proc/self/mountinfo
    set +x

  finish() {
   kill -INT $PYTHON_PID > /dev/null 2>&1
   sudo umount z
   cd $ORIG_WD
   rm -rf overlay_test

  main() {


   [[ $ERROR -eq 0 ]] && echo "OverlayFS looks good."


To manage notifications about this bug go to:

Follow ups