1f67950b2SNasf-Fan#!/bin/ksh -p 2f67950b2SNasf-Fan# 3f67950b2SNasf-Fan# CDDL HEADER START 4f67950b2SNasf-Fan# 5f67950b2SNasf-Fan# The contents of this file are subject to the terms of the 6f67950b2SNasf-Fan# Common Development and Distribution License (the "License"). 7f67950b2SNasf-Fan# You may not use this file except in compliance with the License. 8f67950b2SNasf-Fan# 9f67950b2SNasf-Fan# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10f67950b2SNasf-Fan# or http://www.opensolaris.org/os/licensing. 11f67950b2SNasf-Fan# See the License for the specific language governing permissions 12f67950b2SNasf-Fan# and limitations under the License. 13f67950b2SNasf-Fan# 14f67950b2SNasf-Fan# When distributing Covered Code, include this CDDL HEADER in each 15f67950b2SNasf-Fan# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16f67950b2SNasf-Fan# If applicable, add the following below this CDDL HEADER, with the 17f67950b2SNasf-Fan# fields enclosed by brackets "[]" replaced with your own identifying 18f67950b2SNasf-Fan# information: Portions Copyright [yyyy] [name of copyright owner] 19f67950b2SNasf-Fan# 20f67950b2SNasf-Fan# CDDL HEADER END 21f67950b2SNasf-Fan# 22f67950b2SNasf-Fan 23f67950b2SNasf-Fan# 24f67950b2SNasf-Fan# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 25f67950b2SNasf-Fan# Use is subject to license terms. 26f67950b2SNasf-Fan# 27f67950b2SNasf-Fan 28f67950b2SNasf-Fan# 29f67950b2SNasf-Fan# Copyright (c) 2017 by Fan Yong. All rights reserved. 30f67950b2SNasf-Fan# 31f67950b2SNasf-Fan 32f67950b2SNasf-Fan. $STF_SUITE/tests/functional/projectquota/projectquota_common.kshlib 33f67950b2SNasf-Fan 34f67950b2SNasf-Fan# 35f67950b2SNasf-Fan# DESCRIPTION: 36f67950b2SNasf-Fan# Projectquota can be set beyond the fs quota. 37f67950b2SNasf-Fan# Pprojectquota can be set at a smaller size than its current usage. 38f67950b2SNasf-Fan# 39f67950b2SNasf-Fan# STRATEGY: 40f67950b2SNasf-Fan# 1. set quota to a fs and set a larger size of projectquota 41f67950b2SNasf-Fan# 2. write some data to the fs and set a smaller projectquota 42f67950b2SNasf-Fan# 43f67950b2SNasf-Fan 44f67950b2SNasf-Fanfunction cleanup 45f67950b2SNasf-Fan{ 46f67950b2SNasf-Fan log_must cleanup_projectquota 47f67950b2SNasf-Fan log_must zfs set quota=none $QFS 48f67950b2SNasf-Fan} 49f67950b2SNasf-Fan 50f67950b2SNasf-Fanlog_onexit cleanup 51f67950b2SNasf-Fan 52f67950b2SNasf-Fanlog_assert "Check set projectquota to larger than the quota size of a fs" 53f67950b2SNasf-Fan 54f67950b2SNasf-Fanlog_must zfs set quota=200m $QFS 55f67950b2SNasf-Fanlog_must zfs set projectquota@$PRJID1=500m $QFS 56f67950b2SNasf-Fan 57f67950b2SNasf-Fanlog_must zfs get projectquota@$PRJID1 $QFS 58f67950b2SNasf-Fan 59f67950b2SNasf-Fanlog_note "write some data to the $QFS" 60f67950b2SNasf-Fanmkmount_writable $QFS 61f67950b2SNasf-Fanlog_must user_run $PUSER mkdir $PRJDIR 62f67950b2SNasf-Fan# log_must chattr +P -p $PRJID1 $PRJDIR 63f67950b2SNasf-Fanlog_must zfs project -s -p $PRJID1 $PRJDIR 64f67950b2SNasf-Fanlog_must user_run $PUSER mkfile 100m $PRJDIR/qf 65*09fbbb7dSAllan Judesync_all_pools 66f67950b2SNasf-Fan 67f67950b2SNasf-Fanlog_note "set projectquota at a smaller size than its current usage" 68f67950b2SNasf-Fanlog_must zfs set projectquota@$PRJID1=90m $QFS 69f67950b2SNasf-Fan 70f67950b2SNasf-Fanlog_must zfs get projectquota@$PRJID1 $QFS 71f67950b2SNasf-Fan 72f67950b2SNasf-Fanlog_pass "set projectquota to larger than quota size of a fs" 73