From: Darrick J. Wong <djwong@xxxxxxxxxx> If the kernel advertises realtime quota support, test it. Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> --- common/populate | 2 +- common/quota | 12 ++++++------ common/xfs | 12 ++++++++++++ 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/common/populate b/common/populate index 1e51eedddc..538cbc86fc 100644 --- a/common/populate +++ b/common/populate @@ -240,7 +240,7 @@ _populate_xfs_qmount_option() if [ ! -f /proc/fs/xfs/xqmstat ]; then # No quota support return - elif [ "${USE_EXTERNAL}" = "yes" ] && [ ! -z "${SCRATCH_RTDEV}" ]; then + elif [ "${USE_EXTERNAL}" = "yes" ] && [ ! -z "${SCRATCH_RTDEV}" ] && ! _xfs_supports_rtquota; then # Quotas not supported on rt filesystems return elif [ -z "${XFS_QUOTA_PROG}" ]; then diff --git a/common/quota b/common/quota index 6b529bf4b4..565057d932 100644 --- a/common/quota +++ b/common/quota @@ -23,10 +23,10 @@ _require_quota() if [ ! -f /proc/fs/xfs/xqmstat ]; then _notrun "Installed kernel does not support XFS quotas" fi - if [ "$USE_EXTERNAL" = yes -a ! -z "$TEST_RTDEV" ]; then + if [ "$USE_EXTERNAL" = yes ] && [ -n "$TEST_RTDEV" ] && ! _xfs_supports_rtquota; then _notrun "Quotas not supported on realtime test device" fi - if [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ]; then + if [ "$USE_EXTERNAL" = yes ] && [ -n "$SCRATCH_RTDEV" ] && ! _xfs_supports_rtquota; then _notrun "Quotas not supported on realtime scratch device" fi ;; @@ -44,10 +44,10 @@ _require_xfs_quota() { $here/src/feature -q $TEST_DEV [ $? -ne 0 ] && _notrun "Installed kernel does not support XFS quota" - if [ "$USE_EXTERNAL" = yes -a ! -z "$TEST_RTDEV" ]; then + if [ "$USE_EXTERNAL" = yes ] && [ -n "$TEST_RTDEV" ] && ! _xfs_supports_rtquota; then _notrun "Quotas not supported on realtime test device" fi - if [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ]; then + if [ "$USE_EXTERNAL" = yes ] && [ -n "$SCRATCH_RTDEV" ] && ! _xfs_supports_rtquota; then _notrun "Quotas not supported on realtime scratch device" fi [ -n "$XFS_QUOTA_PROG" ] || _notrun "XFS quota user tools not installed" @@ -153,8 +153,8 @@ _require_prjquota() fi $here/src/feature -P $_dev [ $? -ne 0 ] && _notrun "Installed kernel does not support project quotas" - if [ "$USE_EXTERNAL" = yes ]; then - if [ -n "$TEST_RTDEV" -o -n "$SCRATCH_RTDEV" ]; then + if [ "$FSTYP" = "xfs" ] && [ "$USE_EXTERNAL" = yes ]; then + if [ -n "$TEST_RTDEV" -o -n "$SCRATCH_RTDEV" ] && ! _xfs_supports_rtquota; then _notrun "Project quotas not supported on realtime filesystem" fi fi diff --git a/common/xfs b/common/xfs index 69a0eb620c..56c4b20889 100644 --- a/common/xfs +++ b/common/xfs @@ -2194,3 +2194,15 @@ _scratch_find_rt_metadir_entry() { return 1 } + +_xfs_supports_rtquota() { + test "$FSTYP" = "xfs" || return 1 + + local xqmfile="/proc/fs/xfs/xqm" + + test -e "$xqmfile" || modprobe xfs + test -e "$xqmfile" || return 1 + + local rtquota="$(cat "$xqmfile" | awk '{print $5}')" + test "$rtquota" = "1" +}