From nobody@FreeBSD.org Fri Jul 2 01:11:28 2004 Return-Path: Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BA7C116A4CE for ; Fri, 2 Jul 2004 01:11:28 +0000 (GMT) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id B440543D41 for ; Fri, 2 Jul 2004 01:11:28 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.12.11/8.12.11) with ESMTP id i621Agih037791 for ; Fri, 2 Jul 2004 01:10:42 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.11/8.12.11/Submit) id i621Ag2H037790; Fri, 2 Jul 2004 01:10:42 GMT (envelope-from nobody) Message-Id: <200407020110.i621Ag2H037790@www.freebsd.org> Date: Fri, 2 Jul 2004 01:10:42 GMT From: John Kozubik To: freebsd-gnats-submit@FreeBSD.org Subject: UFS2 snapshot files can be mounted read-write and written to X-Send-Pr-Version: www-2.3 >Number: 68576 >Category: kern >Synopsis: UFS2 snapshot files can be mounted read-write and written to >Confidential: no >Severity: serious >Priority: medium >Responsible: rwatson >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jul 02 01:20:18 GMT 2004 >Closed-Date: Sun Jan 27 12:39:58 UTC 2008 >Last-Modified: Sun Jan 27 12:39:58 UTC 2008 >Originator: John Kozubik >Release: FreeBSD 5.2.1-RELEASE >Organization: http://www.kozubik.com >Environment: FreeBSD kozubik 5.2.1-RELEASE FreeBSD 5.2.1-RELEASE #0: Mon Feb 23 20:45:55 GMT 2004 root@wv1u.btc.adaptec.com:/usr/obj/usr/src/sys/GENERIC i386 >Description: Snapshot files are not to be written to in any circumstance. After mounting the snapshot as per the snapshot documentation, however, one can successfully run `mount -uw` on the mounted snapshot file, thus mounting it read/write. One can then write new files to the snapshot file and alter existing files in it. >How-To-Repeat: 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. >Fix: A workaround would be to not mount snapshot files read/write. A more robust workaround would be to add an exception to `mount` that would disallow mounting a snapshot read/write. This would follow the existing trend of writing exceptions into common commands (`rm` for instance) to deal with the special needs of snapshot files. I'm not sure if all these exceptions are a good idea, though, especially if more will be needed as time goes on. >Release-Note: >Audit-Trail: Responsible-Changed-From-To: freebsd-bugs->rwatson Responsible-Changed-By: rwatson Responsible-Changed-When: Tue Jul 6 05:07:32 GMT 2004 Responsible-Changed-Why: I'll grab ownership of this one; I've done some prelimary investigation and chatted with Kirk at USENIX about the intended behavior, as well as with phk about how best to accomplish the desired semantics. Patch to follow shortly. http://www.freebsd.org/cgi/query-pr.cgi?pr=68576 From: Gavin Atkinson To: bug-followup@FreeBSD.org, john@kozubik.com Cc: Subject: Re: kern/68576: UFS2 snapshot files can be mounted read write and written to Date: Thu, 26 Apr 2007 10:56:49 +0100 This seems to be fixed in at least FreeBSD 6.2. I don't have a 5.x machine handy to test with. From: John Kozubik To: Gavin Atkinson Cc: bug-followup@FreeBSD.org Subject: Re: kern/68576: UFS2 snapshot files can be mounted read write and written to Date: Thu, 26 Apr 2007 13:17:41 -0700 (PDT) On Thu, 26 Apr 2007, Gavin Atkinson wrote: > This seems to be fixed in at least FreeBSD 6.2. I don't have a 5.x > machine handy to test with. Yes, I believe that has been fixed for a little while now ... I have not, however, tested it in any capacity. State-Changed-From-To: open->closed State-Changed-By: rwatson State-Changed-When: Sun Jan 27 12:36:21 UTC 2008 State-Changed-Why: Locally confirmed to be fixed: cinnamon-freebsd# mksnap_ffs /mnt /mnt/snap1 cinnamon-freebsd# mdconfig -a -t vnode -f /mnt/snap1 WARNING: opening backing store: /mnt/snap1 readonly md1 cinnamon-freebsd# mount /dev/md1 /snapmnt/ mount: /dev/md1 : Read-only file system cinnamon-freebsd# mount | grep snap cinnamon-freebsd# mount -o ro /dev/md1 /snapmnt cinnamon-freebsd# mount | grep snap /dev/md1 on /snapmnt (ufs, local, read-only) http://www.freebsd.org/cgi/query-pr.cgi?pr=68576 >Unformatted: