Skip to content

Commit

Permalink
ore: Unlock r4w pages in exact reverse order of locking
Browse files Browse the repository at this point in the history
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: Boaz Harrosh <bharrosh@panasas.com>
  • Loading branch information
Boaz Harrosh committed Jul 20, 2012
1 parent 62b62ad commit 537632e
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions fs/exofs/ore_raid.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,26 +144,26 @@ static void _sp2d_reset(struct __stripe_pages_2d *sp2d,
{
unsigned data_devs = sp2d->data_devs;
unsigned group_width = data_devs + sp2d->parity;
unsigned p;
int p, c;

if (!sp2d->needed)
return;

for (p = 0; p < sp2d->pages_in_unit; p++) {
struct __1_page_stripe *_1ps = &sp2d->_1p_stripes[p];

if (_1ps->write_count < group_width) {
unsigned c;
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];

for (c = 0; c < data_devs; c++)
if (_1ps->page_is_read[c]) {
struct page *page = _1ps->pages[c];
if (_1ps->page_is_read[c]) {
struct page *page = _1ps->pages[c];

r4w->put_page(priv, page);
_1ps->page_is_read[c] = false;
}
r4w->put_page(priv, page);
_1ps->page_is_read[c] = false;
}
}

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));
_1ps->write_count = 0;
_1ps->tx = NULL;
Expand Down

0 comments on commit 537632e

Please sign in to comment.