lkml.org 
[lkml]   [2023]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectWeirdness with bind mounts and moving files from tmpfs
Dear list,

If a file is copied from tmpfs onto a bind mount, the contents update
as expected. However if a file is _moved_ from tmpfs onto a bind
mount, the old content persists.

For example, my PC has a tmpfs on /run:

# findmnt /run
TARGET SOURCE FSTYPE OPTIONS
/run tmpfs tmpfs rw,nosuid,nodev,noexec,relatime,size=5737612k,mode=755,inode64

Set up a bind mounted file...

# touch /opt/file
# echo one > /home/file
# mount -o bind /home/file /opt/file
# cat /opt/file
one

Coping a file onto the bind mount via the tmpfs on /run yields...

# echo two > /run/file
# cp /run/file /home/file
# cat /opt/file
two

So far, so good. Now do the same, but with 'mv' instead of 'cp'...

# echo three > /run/file
# mv /run/file /home/file
# cat /opt/file
two

At this point, the contents of /opt/file are stuck forever with "two"...

# echo three > /run/file
# cp /run/file /home/file
# cat /opt/file
two
# echo three > /home/file
# cat /opt/file
two

What is going on here? Is this a bug or a feature?

Thanks,
Richard

\
 
 \ /
  Last update: 2023-04-14 02:24    [W:0.026 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site