Re: [PATCH 14/16] blkcg: don't allow or retain configuration ofmissing devices

From: Vivek Goyal
Date: Tue Jan 24 2012 - 10:42:27 EST


On Mon, Jan 23, 2012 at 03:09:51PM -0800, Tejun Heo wrote:

[..]
> static int blkio_policy_parse_and_set(char *buf,
> - struct blkio_policy_node *newpn, enum blkio_policy_id plid, int fileid)
> + struct blkio_policy_node *newpn,
> + enum blkio_policy_id plid, int fileid,
> + struct blkio_cgroup *blkcg)
> {
> struct gendisk *disk = NULL;
> + struct blkio_group *blkg = NULL;
> char *s[4], *p, *major_s = NULL, *minor_s = NULL;
> unsigned long major, minor;
> int i = 0, ret = -EINVAL;
> @@ -868,12 +871,19 @@ static int blkio_policy_parse_and_set(char *buf,
> goto out;
>
> /* For rule removal, do not check for device presence. */
> - if (temp) {
> - disk = get_gendisk(dev, &part);
> - if (!disk || part) {
> - ret = -ENODEV;
> - goto out;
> - }
> + disk = get_gendisk(dev, &part);
> +
> + if ((!disk || part) && temp) {
> + ret = -ENODEV;
> + goto out;
> + }
> +
> + rcu_read_lock();
> +
> + if (disk && !part) {
> + spin_lock_irq(disk->queue->queue_lock);
> + blkg = blkg_lookup_create(blkcg, disk->queue, plid);
> + spin_unlock_irq(disk->queue->queue_lock);

If queue is in bypass mode, is group creation and linking allowed when
somebody is trying to set per device rules. (/me is thinking if there are
any potential races between elevator switch and rule setting in cgroup).

Thanks
Vivek
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/