if (lqi->qi_files[type] == NULL) {
CERROR("operate qinfo before it's enabled!\n");
- RETURN(-EIO);
+ RETURN(-ESRCH);
}
switch (cmd) {
if (dquot->dq_info->qi_files[dquot->dq_type] == NULL) {
CERROR("operate dquot before it's enabled!\n");
- RETURN(-EIO);
+ RETURN(-ESRCH);
}
switch (cmd) {
/* Invalidated quota? */
if (!dquot->dq_info || !(filp = dquot->dq_info->qi_files[type])) {
CDEBUG(D_ERROR, "VFS: Quota invalidated while reading!\n");
- return -EIO;
+ return -ESRCH;
}
version = dquot->dq_info->qi_version;
rc = -EPROTO;
}
+ if (unlikely(rc == -ESRCH))
+ CERROR("quota for %s has been enabled by master, but disabled "
+ "by slave.\n", QDATA_IS_GRP(qdata) ? "group" : "user");
+
rc = dqacq_completion(obd, qctxt, qdata, rc,
lustre_msg_get_opc(req->rq_reqmsg));
break;
}
+ /* Related quota has been disabled by master, but enabled by
+ * slave, do not try again. */
+ if (unlikely(rc == -ESRCH)) {
+ CERROR("mismatched quota configuration, stop try.\n");
+ break;
+ }
+
/* -EBUSY and others, wait a second and try again */
if (rc < 0) {
cfs_waitq_t waitq;
[ $MDSCOUNT -gt 1 ] && skip "CMD case" && exit 0
-unset ENABLE_QUOTA
-
remote_mds_nodsh && skip "remote MDS with nodsh" && exit 0
remote_ost_nodsh && skip "remote OST with nodsh" && exit 0
DIR=${DIR:-$MOUNT}
DIR2=${DIR2:-$MOUNT2}
+QUOTA_AUTO_OLD=$QUOTA_AUTO
+export QUOTA_AUTO=0
+
check_and_setup_lustre
if [ x"$(som_check)" = x"enabled" ]; then
echo "Som is enabled, Quota is temporary conflicts with it"
check_and_cleanup_lustre
+ export QUOTA_AUTO=$QUOTA_AUTO_OLD
exit 0
fi
cd $ORIG_PWD
check_and_cleanup_lustre
echo '=========================== finished ==============================='
+export QUOTA_AUTO=$QUOTA_AUTO_OLD
[ -f "$QUOTALOG" ] && cat $QUOTALOG && grep -q FAIL $QUOTALOG && exit 1 || true
echo "$0: completed"
export GSS_KRB5=false
export GSS_PIPEFS=false
export IDENTITY_UPCALL=default
+export QUOTA_AUTO=1
#export PDSH="pdsh -S -Rssh -w"
setup_quota(){
local mntpt=$1
- # We need:
- # 1. run quotacheck only if quota is off
- # 2. save the original quota_type params, restore them after testing
+ # We need save the original quota_type params, and restore them after testing
# Suppose that quota type the same on mds and ost
local quota_type=$(quota_type | grep MDT | cut -d "=" -f2)
if [ "$quota_type" != "$QUOTA_TYPE" ]; then
export old_QUOTA_TYPE=$quota_type
quota_save_version $QUOTA_TYPE
+ else
+ qtype=$(tr -c -d "ug" <<< $QUOTA_TYPE)
+ $LFS quotacheck -$qtype $mntpt || error "quotacheck has failed for $type"
fi
local quota_usrs=$QUOTA_USERS
if [ x"$(som_check)" = x"enabled" ]; then
ENABLE_QUOTA=""
+ echo "disable quota temporary when SOM enabled"
fi
- if [ "$ENABLE_QUOTA" ]; then
- setup_quota $MOUNT || return 2
+ if [ $QUOTA_AUTO -ne 0 ]; then
+ if [ "$ENABLE_QUOTA" ]; then
+ echo "enable quota as required"
+ setup_quota $MOUNT || return 2
+ else
+ echo "disable quota as required"
+ $LFS quotaoff -ug $MOUNT > /dev/null 2>&1
+ fi
fi
}