summaryrefslogtreecommitdiffstats
path: root/sys/ufs/ffs/ffs_inode.c
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2000-07-26 23:07:01 +0000
committermckusick <mckusick@FreeBSD.org>2000-07-26 23:07:01 +0000
commitb86877bef05dab48d7c3a733431361260c18fa81 (patch)
tree30ca740a52fe6adb75f12ae761ec884d3c05e7c4 /sys/ufs/ffs/ffs_inode.c
parent97118d11db99484338915c391830f5e9ad423dc2 (diff)
downloadFreeBSD-src-b86877bef05dab48d7c3a733431361260c18fa81.zip
FreeBSD-src-b86877bef05dab48d7c3a733431361260c18fa81.tar.gz
Clean up the snapshot code so that it no longer depends on the use of
the SF_IMMUTABLE flag to prevent writing. Instead put in explicit checking for the SF_SNAPSHOT flag in the appropriate places. With this change, it is now possible to rename and link to snapshot files. It is also possible to set or clear any of the owner, group, or other read bits on the file, though none of the write or execute bits can be set. There is also an explicit test to prevent the setting or clearing of the SF_SNAPSHOT flag via chflags() or fchflags(). Note also that the modify time cannot be changed as it needs to accurately reflect the time that the snapshot was taken. Submitted by: Robert Watson <rwatson@FreeBSD.org>
Diffstat (limited to 'sys/ufs/ffs/ffs_inode.c')
-rw-r--r--sys/ufs/ffs/ffs_inode.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c
index 4725090..30f36ee7 100644
--- a/sys/ufs/ffs/ffs_inode.c
+++ b/sys/ufs/ffs/ffs_inode.c
@@ -45,6 +45,7 @@
#include <sys/vnode.h>
#include <sys/malloc.h>
#include <sys/resourcevar.h>
+#include <sys/stat.h>
#include <vm/vm.h>
#include <vm/vm_extern.h>
@@ -174,6 +175,8 @@ ffs_truncate(vp, length, flags, cred, p)
if (error)
return (error);
#endif
+ if ((oip->i_flags & SF_SNAPSHOT) != 0)
+ ffs_snapremove(ovp);
ovp->v_lasta = ovp->v_clen = ovp->v_cstart = ovp->v_lastw = 0;
if (DOINGSOFTDEP(ovp)) {
if (length > 0) {
OpenPOWER on IntegriCloud