diff options
author | pjd <pjd@FreeBSD.org> | 2011-12-18 12:19:03 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2011-12-18 12:19:03 +0000 |
commit | 3c1d6d15932737a320fd0860781f16898f43ef5f (patch) | |
tree | 6928d344a42773625d4b57f524bed518df996663 | |
parent | af15d16c0e9add54cec0a0f1a0deae9595937e9e (diff) | |
download | FreeBSD-src-3c1d6d15932737a320fd0860781f16898f43ef5f.zip FreeBSD-src-3c1d6d15932737a320fd0860781f16898f43ef5f.tar.gz |
Implement replying of ACLs updates. ACL changes should go to ZIL only
if the 'sync' property is set to 'always', so replying them is not common.
MFC after: 1 month
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c | 27 | ||||
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c | 2 |
2 files changed, 16 insertions, 13 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c index ebea17a..db68623 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c @@ -904,11 +904,15 @@ zfs_replay_setattr(zfsvfs_t *zfsvfs, lr_setattr_t *lr, boolean_t byteswap) return (error); } +extern int zfs_setsecattr(vnode_t *vp, vsecattr_t *vsecp, int flag, cred_t *cr, + caller_context_t *ct); + static int zfs_replay_acl_v0(zfsvfs_t *zfsvfs, lr_acl_v0_t *lr, boolean_t byteswap) { ace_t *ace = (ace_t *)(lr + 1); /* ace array follows lr_acl_t */ vsecattr_t vsa; + vnode_t *vp; znode_t *zp; int error; @@ -927,13 +931,12 @@ zfs_replay_acl_v0(zfsvfs_t *zfsvfs, lr_acl_v0_t *lr, boolean_t byteswap) vsa.vsa_aclflags = 0; vsa.vsa_aclentp = ace; -#ifdef TODO - error = VOP_SETSECATTR(ZTOV(zp), &vsa, 0, kcred, NULL); -#else - panic("%s:%u: unsupported condition", __func__, __LINE__); -#endif + vp = ZTOV(zp); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + error = zfs_setsecattr(vp, &vsa, 0, kcred, NULL); + VOP_UNLOCK(vp, 0); - VN_RELE(ZTOV(zp)); + VN_RELE(vp); return (error); } @@ -958,6 +961,7 @@ zfs_replay_acl(zfsvfs_t *zfsvfs, lr_acl_t *lr, boolean_t byteswap) ace_t *ace = (ace_t *)(lr + 1); vsecattr_t vsa; znode_t *zp; + vnode_t *vp; int error; if (byteswap) { @@ -973,7 +977,6 @@ zfs_replay_acl(zfsvfs_t *zfsvfs, lr_acl_t *lr, boolean_t byteswap) if ((error = zfs_zget(zfsvfs, lr->lr_foid, &zp)) != 0) return (error); -#ifdef TODO bzero(&vsa, sizeof (vsa)); vsa.vsa_mask = VSA_ACE | VSA_ACECNT | VSA_ACE_ACLFLAGS; vsa.vsa_aclcnt = lr->lr_aclcnt; @@ -990,16 +993,16 @@ zfs_replay_acl(zfsvfs_t *zfsvfs, lr_acl_t *lr, boolean_t byteswap) lr->lr_fuidcnt, lr->lr_domcnt, 0, 0); } - error = VOP_SETSECATTR(ZTOV(zp), &vsa, 0, kcred, NULL); + vp = ZTOV(zp); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + error = zfs_setsecattr(vp, &vsa, 0, kcred, NULL); + VOP_UNLOCK(vp, 0); if (zfsvfs->z_fuid_replay) zfs_fuid_info_free(zfsvfs->z_fuid_replay); -#else - error = EOPNOTSUPP; -#endif zfsvfs->z_fuid_replay = NULL; - VN_RELE(ZTOV(zp)); + VN_RELE(vp); return (error); } diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c index 8d8ddfc..d218ab6 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c @@ -5163,7 +5163,7 @@ zfs_getsecattr(vnode_t *vp, vsecattr_t *vsecp, int flag, cred_t *cr, } /*ARGSUSED*/ -static int +int zfs_setsecattr(vnode_t *vp, vsecattr_t *vsecp, int flag, cred_t *cr, caller_context_t *ct) { |