diff options
author | NeilBrown <neilb@suse.de> | 2009-04-06 00:40:38 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-04-06 00:40:38 -0400 |
commit | 303a0e11d0ee136ad8f53f747f3c377daece763b (patch) | |
tree | 197f4a00ec3eba9e00cdc264c25749914667c389 /drivers/md | |
parent | 6bb597507f9839b13498781e481f5458aea33620 (diff) |
md/raid1 - don't assume newly allocated bvecs are initialised.
Since commit d3f761104b097738932afcc310fbbbbfb007ef92
newly allocated bvecs aren't initialised to NULL, so we have
to be more careful about freeing a bio which only managed
to get a few pages allocated to it. Otherwise the resync
process crashes.
This patch is appropriate for 2.6.29-stable.
Cc: stable@kernel.org
Cc: "Jens Axboe" <jens.axboe@oracle.com>
Reported-by: Gabriele Tozzi <gabriele@tozzi.eu>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/raid1.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index b4f4badc0068..f2247b0cd1a7 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -123,6 +123,7 @@ static void * r1buf_pool_alloc(gfp_t gfp_flags, void *data) | |||
123 | goto out_free_pages; | 123 | goto out_free_pages; |
124 | 124 | ||
125 | bio->bi_io_vec[i].bv_page = page; | 125 | bio->bi_io_vec[i].bv_page = page; |
126 | bio->bi_vcnt = i+1; | ||
126 | } | 127 | } |
127 | } | 128 | } |
128 | /* If not user-requests, copy the page pointers to all bios */ | 129 | /* If not user-requests, copy the page pointers to all bios */ |
@@ -138,9 +139,9 @@ static void * r1buf_pool_alloc(gfp_t gfp_flags, void *data) | |||
138 | return r1_bio; | 139 | return r1_bio; |
139 | 140 | ||
140 | out_free_pages: | 141 | out_free_pages: |
141 | for (i=0; i < RESYNC_PAGES ; i++) | 142 | for (j=0 ; j < pi->raid_disks; j++) |
142 | for (j=0 ; j < pi->raid_disks; j++) | 143 | for (i=0; i < r1_bio->bios[j]->bi_vcnt ; i++) |
143 | safe_put_page(r1_bio->bios[j]->bi_io_vec[i].bv_page); | 144 | put_page(r1_bio->bios[j]->bi_io_vec[i].bv_page); |
144 | j = -1; | 145 | j = -1; |
145 | out_free_bio: | 146 | out_free_bio: |
146 | while ( ++j < pi->raid_disks ) | 147 | while ( ++j < pi->raid_disks ) |