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
This commit is contained in:
Pawel Jakub Dawidek 2013-11-25 21:17:14 +00:00
parent a9554102f9
commit 1cef014007

View File

@ -4317,6 +4317,11 @@ zfs_link(vnode_t *tdvp, vnode_t *svp, char *name, cred_t *cr,
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.