Comment 0 for bug 1039402

Reinhard Tartler (siretart) wrote :

This is a followup to bug #1038075

Testcase:

$ modprobe overlayfs
$ mkdir /live/tmpfs /tmp/root
$ mount -t nfs -o ro 192.168.42.40:/srv/fai/nfsroot.quantal64 /mnt
$ stat /mnt/etc/resolv.conf
  File: `/mnt/etc/resolv.conf'
  Size: 206 Blocks: 8 IO Block: 1048576 regular file
Device: 1ch/28d Inode: 36044830 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2012-08-20 10:53:27.177775447 +0200
Modify: 2012-08-08 12:50:21.000000000 +0200
Change: 2012-08-16 04:06:12.317826670 +0200
 Birth: -
$ mount -t overlayfs -o noatime,lowerdir=/mnt,upperdir=/live/overlayfs overlayfs /live/root
$ stat /live/root/etc/resolv.conf
  File: `/live/root/etc/resolv.conf'
  Size: 206 Blocks: 8 IO Block: 1048576 regular file
Device: 1ch/28d Inode: 36044830 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2012-08-20 10:53:27.177775447 +0200
Modify: 2012-08-08 12:50:21.000000000 +0200
Change: 2012-08-16 04:06:12.317826670 +0200
 Birth: -
$ echo foo > /live/root/etc/resolv.conf
bash: /live/root/etc/resolv.conf: Permission denied

This permission error does not happen with a local filesystem but only with NFS.

However this seems to work:

$ rm /live/root/etc/resolv.conf
$ echo foo > /live/root/etc/resolv.conf
$ cat /live/root/etc/resolv.conf
foo