]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/md/md.c
Merge tag 'vfio-v4.20-rc1.v2' of git://github.com/awilliam/linux-vfio
[linux.git] / drivers / md / md.c
index 1fa7f1b1d98a6c947df9f8e8e7dcda57b68f9d60..fc488cb30a94780d8a4fee0674d718aa901b047f 100644 (file)
@@ -452,10 +452,11 @@ static void md_end_flush(struct bio *fbio)
        rdev_dec_pending(rdev, mddev);
 
        if (atomic_dec_and_test(&fi->flush_pending)) {
-               if (bio->bi_iter.bi_size == 0)
+               if (bio->bi_iter.bi_size == 0) {
                        /* an empty barrier - all done */
                        bio_endio(bio);
-               else {
+                       mempool_free(fi, mddev->flush_pool);
+               } else {
                        INIT_WORK(&fi->flush_work, submit_flushes);
                        queue_work(md_wq, &fi->flush_work);
                }
@@ -509,10 +510,11 @@ void md_flush_request(struct mddev *mddev, struct bio *bio)
        rcu_read_unlock();
 
        if (atomic_dec_and_test(&fi->flush_pending)) {
-               if (bio->bi_iter.bi_size == 0)
+               if (bio->bi_iter.bi_size == 0) {
                        /* an empty barrier - all done */
                        bio_endio(bio);
-               else {
+                       mempool_free(fi, mddev->flush_pool);
+               } else {
                        INIT_WORK(&fi->flush_work, submit_flushes);
                        queue_work(md_wq, &fi->flush_work);
                }