public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: fstests@vger.kernel.org
Subject: [PATCH 1/3] common/cgroup2: better error message if cgroup2 fs is not mounted
Date: Mon, 15 Jul 2019 10:25:21 +0200	[thread overview]
Message-ID: <20190715082523.18387-1-hch@lst.de> (raw)

Improve the _require_cgroup2 helper to print a more useful message
if the cgroup2 fs is not mounted.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 common/cgroup2 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/common/cgroup2 b/common/cgroup2
index f89825e2..8833c9c8 100644
--- a/common/cgroup2
+++ b/common/cgroup2
@@ -4,9 +4,14 @@ export CGROUP2_PATH="${CGROUP2_PATH:-/sys/fs/cgroup}"
 
 _require_cgroup2()
 {
+	if [ `findmnt -d backward -n -o FSTYPE -f ${CGROUP2_PATH}` != "cgroup2" ]; then
+		_notrun "cgroup2 not mounted on ${CGROUP2_PATH}"
+	fi
+
 	if [ ! -f "${CGROUP2_PATH}/cgroup.subtree_control" ]; then
 		_notrun "Test requires cgroup2 enabled"
 	fi
+
 	if [[ ! $(cat ${CGROUP2_PATH}/cgroup.controllers) =~ $1 ]]; then
 		_notrun "Cgroup2 doesn't support $1 controller $1"
 	fi
-- 
2.20.1

             reply	other threads:[~2019-07-15  8:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-15  8:25 Christoph Hellwig [this message]
2019-07-15  8:25 ` [PATCH 2/3] shared/011: run for all block device based file systems Christoph Hellwig
2019-07-15  8:25 ` [PATCH 3/3] shared/011: move to generic/ Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190715082523.18387-1-hch@lst.de \
    --to=hch@lst.de \
    --cc=fstests@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox