CGROUP fixes
authorJens Axboe <jens.axboe@oracle.com>
Fri, 4 Dec 2009 09:54:45 +0000 (10:54 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Fri, 4 Dec 2009 09:54:45 +0000 (10:54 +0100)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
cgroup.c
options.c

index 15641e672e2e071e56088c6685d2664dc48b9df9..548740a08e9bd0f12741def199e40dc8843cc50d 100644 (file)
--- a/cgroup.c
+++ b/cgroup.c
@@ -6,6 +6,18 @@
 #include "fio.h"
 #include "cgroup.h"
 
+/*
+ * Check if the given root appears valid
+ */
+static int cgroup_check_fs(struct thread_data *td)
+{
+       struct stat sb;
+       char tmp[256];
+
+       sprintf(tmp, "%s/tasks", td->o.cgroup_root);
+       return stat(tmp, &sb);
+}
+
 static char *get_cgroup_root(struct thread_data *td)
 {
        char *str = malloc(64);
@@ -67,6 +79,12 @@ int cgroup_setup(struct thread_data *td)
        char *root, tmp[256];
        FILE *f;
 
+       if (cgroup_check_fs(td)) {
+               log_err("fio: blkio cgroup mount point %s not valid\n",
+                                                       td->o.cgroup_root);
+               return 1;
+       }
+
        /*
         * Create container, if it doesn't exist
         */
@@ -100,6 +118,8 @@ int cgroup_setup(struct thread_data *td)
 
 void cgroup_shutdown(struct thread_data *td)
 {
+       if (cgroup_check_fs(td))
+               return;
        if (!td->o.cgroup_weight)
                return;
 
index cb6337c27207664b80ac7acd81156ade8687519b..77cfd424ed2b9e2de6506f6961a182d89a1614d4 100644 (file)
--- a/options.c
+++ b/options.c
@@ -1746,7 +1746,6 @@ static struct fio_option options[] = {
                .help   = "Use given weight for cgroup",
                .minval = 100,
                .maxval = 1000,
-               .def    = "0",
        },
        {
                .name = NULL,