Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Nov 2013 21:17:14 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r258597 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201311252117.rAPLHEAY039885@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pjd
Date: Mon Nov 25 21:17:14 2013
New Revision: 258597
URL: http://svnweb.freebsd.org/changeset/base/258597

Log:
  When append-only, immutable or read-only flag is set don't allow for
  hard links creation. This matches UFS behaviour.
  
  Reported by:	Oleg Ginzburg <olevole@olevole.ru>
  MFC after:	1 month

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c	Mon Nov 25 21:12:56 2013	(r258596)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c	Mon Nov 25 21:17:14 2013	(r258597)
@@ -4317,6 +4317,11 @@ zfs_link(vnode_t *tdvp, vnode_t *svp, ch
 	szp = VTOZ(svp);
 	ZFS_VERIFY_ZP(szp);
 
+	if (szp->z_pflags & (ZFS_APPENDONLY | ZFS_IMMUTABLE | ZFS_READONLY)) {
+		ZFS_EXIT(zfsvfs);
+		return (SET_ERROR(EPERM));
+	}
+
 	/*
 	 * We check z_zfsvfs rather than v_vfsp here, because snapshots and the
 	 * ctldir appear to have the same v_vfsp.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311252117.rAPLHEAY039885>