the patch mosly looks good, except for one place:

On (02/02/15 13:28), Minchan Kim wrote:
> @@ -783,6 +812,8 @@ static ssize_t disksize_store(struct device *dev,
>               goto out_destroy_comp;
>       }
>  
> +     init_waitqueue_head(&zram->io_done);
> +     zram_meta_get(zram);

it was
+       init_completion(&zram->io_done);
+       atomic_set(&zram->refcount, 1);

I think we need to replace zram_meta_get(zram) with atomic_set(&zram->refcount, 
1).

->refcount is 0 by default and atomic_inc_not_zero(&zram->refcount) will not
increment it here, nor anywhere else.


>       zram->meta = meta;
>       zram->comp = comp;
>       zram->disksize = disksize;
> @@ -838,8 +869,8 @@ static ssize_t reset_store(struct device *dev,
>       /* Make sure all pending I/O is finished */
>       fsync_bdev(bdev);
>       bdput(bdev);
> -

[..]

> @@ -1041,6 +1075,7 @@ static int create_device(struct zram *zram, int 
> device_id)
>       int ret = -ENOMEM;
>  
>       init_rwsem(&zram->init_lock);
> +     atomic_set(&zram->refcount, 0);

sorry, I forgot that zram is kzalloc()-ated. so we can drop

        atomic_set(&zram->refcount, 0)

>       zram->queue = blk_alloc_queue(GFP_KERNEL);
>       if (!zram->queue) {


        -ss
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to