summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorNasf-Fan <[email protected]>2018-03-06 04:56:27 +0800
committerBrian Behlendorf <[email protected]>2018-03-05 12:56:27 -0800
commit2705ebf0a74f15bb246fb899f19b0ee17aa1c4b5 (patch)
tree8ba5896d7bcf69891d85dadec737631aaa7d6e2e /module
parentdd3e1e3083e6b80ac7cc4dabfbf9b5036b7a889d (diff)
Misc fixes and cleanup for project quota
1) The Coverity Scan reports some issues for the project quota patch, including: 1.1) zfs_prop_get_userquota() directly uses the const quota type value as the condition check by wrong. 1.2) dmu_objset_userquota_get_ids() may cause dnode::dn_newgid to be overwritten by dnode::dn->dn_oldprojid. 2) This patch fixes related issues. It also enhances the logic for zfs_project_item_alloc() to avoid buffer overflow. 3) Skip project quota ability check if does not change project quota related things (id or flag). Otherwise, it will cause chattr (for other non project quota flags) operation failed if project quota disabled. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Fan Yong <[email protected]> Closes #7251 Closes #7265
Diffstat (limited to 'module')
-rw-r--r--module/zfs/dmu_objset.c2
-rw-r--r--module/zfs/zfs_vnops.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/module/zfs/dmu_objset.c b/module/zfs/dmu_objset.c
index d7c46c3e5..c2dd31a8b 100644
--- a/module/zfs/dmu_objset.c
+++ b/module/zfs/dmu_objset.c
@@ -2077,7 +2077,7 @@ dmu_objset_userquota_get_ids(dnode_t *dn, boolean_t before, dmu_tx_t *tx)
if (flags & DN_ID_OLD_EXIST) {
dn->dn_newuid = dn->dn_olduid;
dn->dn_newgid = dn->dn_oldgid;
- dn->dn_newgid = dn->dn_oldprojid;
+ dn->dn_newprojid = dn->dn_oldprojid;
} else {
dn->dn_newuid = 0;
dn->dn_newgid = 0;
diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
index f35165de3..a2d7d7b24 100644
--- a/module/zfs/zfs_vnops.c
+++ b/module/zfs/zfs_vnops.c
@@ -2891,10 +2891,12 @@ zfs_setattr(struct inode *ip, vattr_t *vap, int flags, cred_t *cr)
}
if (XVA_ISSET_REQ(xvap, XAT_PROJINHERIT) &&
+ (xoap->xoa_projinherit !=
+ ((zp->z_pflags & ZFS_PROJINHERIT) != 0)) &&
(!dmu_objset_projectquota_enabled(os) ||
(!S_ISREG(ip->i_mode) && !S_ISDIR(ip->i_mode)))) {
- ZFS_EXIT(zfsvfs);
- return (SET_ERROR(ENOTSUP));
+ ZFS_EXIT(zfsvfs);
+ return (SET_ERROR(ENOTSUP));
}
}