writing to RW-mounted UFS2 snapshots - confirmed.

John Kozubik john at kozubik.com
Wed Jun 30 12:06:22 PDT 2004


It was mentioned earlier this week that UFS2 snapshots could somehow be
mounted read/write and then written to.  I noticed this a few weeks ago
but didn't think much of it.

I have reproduced this:

mksnap_ffs / /snap1
mkdir /snapmount
mdconfig -a -t vnode -f /snap1 -u 4
mount -r /dev/md4 /snapmount

So far so good ... now enter the mounted snapshot and attempt to write a
file:

# cd /snapmount/
# touch test
touch: test: Read-only file system
#

This is the expected behavior.  However:

#
# pwd
/snapmount
# mount -uw /snapmount
# touch test
# echo sldkfslk >> /snapmount/test
#
# cat /snapmount/test
sldkfslk
#

This is unexpected.  You can successfully mount the snapshot read/write
and create and write to files in that snapshot.  You can also write to
files that existed in the snapshot prior to mounting it read/write.

I have confirmed that if you unmount the snapshot and remount it again
normally, the created file(s) still exist in it, and any changes made to
existing files in the snapshot are persistent as well.

I don't know what context this was being discussed in, but this behavior
does indeed exist, and I believe it to be a somewhat serious problem.


-----
John Kozubik - john at kozubik.com - http://www.kozubik.com



More information about the freebsd-hackers mailing list