]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - block/blk-cgroup.c
Merge branch 'for-2.6.37/core' of git://git.kernel.dk/linux-2.6-block
[mv-sheeva.git] / block / blk-cgroup.c
index 52c12130a5deaf0c5e5354a9c7bf779641cc1a73..b1febd0f6d2a5227f617d82c7d4687e190cfc456 100644 (file)
@@ -656,10 +656,10 @@ static int blkio_policy_parse_and_set(char *buf,
 {
        char *s[4], *p, *major_s = NULL, *minor_s = NULL;
        int ret;
-       unsigned long major, minor, temp, iops;
+       unsigned long major, minor, temp;
        int i = 0;
        dev_t dev;
-       u64 bps;
+       u64 bps, iops;
 
        memset(s, 0, sizeof(s));
 
@@ -731,13 +731,16 @@ static int blkio_policy_parse_and_set(char *buf,
                        break;
                case BLKIO_THROTL_read_iops_device:
                case BLKIO_THROTL_write_iops_device:
-                       ret = strict_strtoul(s[1], 10, &iops);
+                       ret = strict_strtoull(s[1], 10, &iops);
                        if (ret)
                                return -EINVAL;
 
+                       if (iops > THROTL_IOPS_MAX)
+                               return -EINVAL;
+
                        newpn->plid = plid;
                        newpn->fileid = fileid;
-                       newpn->val.iops = iops;
+                       newpn->val.iops = (unsigned int)iops;
                        break;
                }
                break;
@@ -1451,7 +1454,7 @@ blkiocg_create(struct cgroup_subsys *subsys, struct cgroup *cgroup)
 
        /* Currently we do not support hierarchy deeper than two level (0,1) */
        if (parent != cgroup->top_cgroup)
-               return ERR_PTR(-EINVAL);
+               return ERR_PTR(-EPERM);
 
        blkcg = kzalloc(sizeof(*blkcg), GFP_KERNEL);
        if (!blkcg)