Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 242995
b: refs/heads/master
c: 770c4d8
h: refs/heads/master
i:
  242993: beafe2e
  242991: 658d59c
v: v3
  • Loading branch information
Sunil Mushran authored and Joel Becker committed Feb 22, 2011
1 parent ac3ccdd commit 74ead60
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1936a267f1b5a32d4a846608fdcce82ca0f6ac8e
refs/heads/master: 770c4d81e0d2ca45516ddc9ae0a69565790b5533
28 changes: 16 additions & 12 deletions trunk/fs/ocfs2/dlm/dlmdomain.c
Original file line number Diff line number Diff line change
Expand Up @@ -926,9 +926,10 @@ static int dlm_assert_joined_handler(struct o2net_msg *msg, u32 len, void *data,
}

static int dlm_match_regions(struct dlm_ctxt *dlm,
struct dlm_query_region *qr)
struct dlm_query_region *qr,
char *local, int locallen)
{
char *local = NULL, *remote = qr->qr_regions;
char *remote = qr->qr_regions;
char *l, *r;
int localnr, i, j, foundit;
int status = 0;
Expand Down Expand Up @@ -957,13 +958,8 @@ static int dlm_match_regions(struct dlm_ctxt *dlm,
r += O2HB_MAX_REGION_NAME_LEN;
}

local = kmalloc(sizeof(qr->qr_regions), GFP_ATOMIC);
if (!local) {
status = -ENOMEM;
goto bail;
}

localnr = o2hb_get_all_regions(local, O2NM_MAX_REGIONS);
localnr = min(O2NM_MAX_REGIONS, locallen/O2HB_MAX_REGION_NAME_LEN);
localnr = o2hb_get_all_regions(local, (u8)localnr);

/* compare local regions with remote */
l = local;
Expand Down Expand Up @@ -1012,8 +1008,6 @@ static int dlm_match_regions(struct dlm_ctxt *dlm,
}

bail:
kfree(local);

return status;
}

Expand Down Expand Up @@ -1075,6 +1069,7 @@ static int dlm_query_region_handler(struct o2net_msg *msg, u32 len,
{
struct dlm_query_region *qr;
struct dlm_ctxt *dlm = NULL;
char *local = NULL;
int status = 0;
int locked = 0;

Expand All @@ -1083,6 +1078,13 @@ static int dlm_query_region_handler(struct o2net_msg *msg, u32 len,
mlog(0, "Node %u queries hb regions on domain %s\n", qr->qr_node,
qr->qr_domain);

/* buffer used in dlm_mast_regions() */
local = kmalloc(sizeof(qr->qr_regions), GFP_KERNEL);
if (!local) {
status = -ENOMEM;
goto bail;
}

status = -EINVAL;

spin_lock(&dlm_domain_lock);
Expand Down Expand Up @@ -1112,13 +1114,15 @@ static int dlm_query_region_handler(struct o2net_msg *msg, u32 len,
goto bail;
}

status = dlm_match_regions(dlm, qr);
status = dlm_match_regions(dlm, qr, local, sizeof(qr->qr_regions));

bail:
if (locked)
spin_unlock(&dlm->spinlock);
spin_unlock(&dlm_domain_lock);

kfree(local);

return status;
}

Expand Down

0 comments on commit 74ead60

Please sign in to comment.