Commit 537632e0 authored by Boaz Harrosh's avatar Boaz Harrosh

ore: Unlock r4w pages in exact reverse order of locking

The read-4-write pages are locked in address ascending order.
But where unlocked in a way easiest for coding. Fix that,
locks should be released in opposite order of locking, .i.e
descending address order.

I have not hit this dead-lock. It was found by inspecting the
dbug print-outs. I suspect there is an higher lock at caller that
protects us, but fix it regardless.
Signed-off-by: default avatarBoaz Harrosh <bharrosh@panasas.com>
parent 62b62ad8
...@@ -144,18 +144,15 @@ static void _sp2d_reset(struct __stripe_pages_2d *sp2d, ...@@ -144,18 +144,15 @@ static void _sp2d_reset(struct __stripe_pages_2d *sp2d,
{ {
unsigned data_devs = sp2d->data_devs; unsigned data_devs = sp2d->data_devs;
unsigned group_width = data_devs + sp2d->parity; unsigned group_width = data_devs + sp2d->parity;
unsigned p; int p, c;
if (!sp2d->needed) if (!sp2d->needed)
return; return;
for (p = 0; p < sp2d->pages_in_unit; p++) { for (c = data_devs - 1; c >= 0; --c)
for (p = sp2d->pages_in_unit - 1; p >= 0; --p) {
struct __1_page_stripe *_1ps = &sp2d->_1p_stripes[p]; struct __1_page_stripe *_1ps = &sp2d->_1p_stripes[p];
if (_1ps->write_count < group_width) {
unsigned c;
for (c = 0; c < data_devs; c++)
if (_1ps->page_is_read[c]) { if (_1ps->page_is_read[c]) {
struct page *page = _1ps->pages[c]; struct page *page = _1ps->pages[c];
...@@ -164,6 +161,9 @@ static void _sp2d_reset(struct __stripe_pages_2d *sp2d, ...@@ -164,6 +161,9 @@ static void _sp2d_reset(struct __stripe_pages_2d *sp2d,
} }
} }
for (p = 0; p < sp2d->pages_in_unit; p++) {
struct __1_page_stripe *_1ps = &sp2d->_1p_stripes[p];
memset(_1ps->pages, 0, group_width * sizeof(*_1ps->pages)); memset(_1ps->pages, 0, group_width * sizeof(*_1ps->pages));
_1ps->write_count = 0; _1ps->write_count = 0;
_1ps->tx = NULL; _1ps->tx = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment