[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v5 03/10] xen/blkfront: pseudo support for multi hardware queues/rings



> +static void blkif_free(struct blkfront_info *info, int suspend)
> +{
> +     struct grant *persistent_gnt, *n;
> +     unsigned int i;
> +
> +     /* Prevent new requests being issued until we fix things up. */
> +     spin_lock_irq(&info->io_lock);
> +     info->connected = suspend ?
> +             BLKIF_STATE_SUSPENDED : BLKIF_STATE_DISCONNECTED;
> +     /* No more blkif_request(). */
> +     if (info->rq)
> +             blk_mq_stop_hw_queues(info->rq);
> +
> +     /* Remove all persistent grants */
> +     if (!list_empty(&info->grants)) {
> +             list_for_each_entry_safe(persistent_gnt, n,
> +                                      &info->grants, node) {
> +                     list_del(&persistent_gnt->node);
> +                     if (persistent_gnt->gref != GRANT_INVALID_REF) {
> +                             gnttab_end_foreign_access(persistent_gnt->gref,
> +                                                       0, 0UL);
> +                             info->persistent_gnts_c--;
> +                     }
> +                     if (info->feature_persistent)
> +                             __free_page(persistent_gnt->page);
> +                     kfree(persistent_gnt);
> +             }
> +     }
> +     BUG_ON(info->persistent_gnts_c != 0);
> +
> +     for (i = 0; i < info->nr_rings; i++)
> +             blkif_free_ring(&info->rinfo[i]);
> +     kfree(info->rinfo);

?? That should be inside the loop.

Anyhow did this change:

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index d73734f..6b46d4d 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -611,7 +611,7 @@ static int blkif_queue_rw_req(struct request *req, struct 
blkfront_ring_info *ri
                max_grefs += INDIRECT_GREFS(max_grefs);
 
        /*
-        * We have to reserve 'max_grefs' grants at first because persistent
+        * We have to reserve 'max_grefs' grants because persistent
         * grants are shared by all rings.
         */
        if (max_grefs > 0)
@@ -1212,9 +1212,11 @@ static void blkif_free(struct blkfront_info *info, int 
suspend)
        }
        BUG_ON(info->persistent_gnts_c != 0);
 
-       for (i = 0; i < info->nr_rings; i++)
+       for (i = 0; i < info->nr_rings; i++) {
                blkif_free_ring(&info->rinfo[i]);
-       kfree(info->rinfo);
+               kfree(info->rinfo);
+               info->ring = NULL;
+       }
        info->nr_rings = 0;
        spin_unlock_irq(&info->io_lock);
 }

and put in my 'for-jens-4.5' branch.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.