Skip to content

Commit a7e7ffa

Browse files
Alexander Aringteigland
authored andcommitted
fs: dlm: rename stub to local message flag
This patch renames DLM_IFL_STUB_MS to DLM_IFL_LOCAL_MS flag. The DLM_IFL_STUB_MS flag is somewhat misnamed, it means the dlm message is used for local message transfer only. It is used by recovery to resolve lock states if a node got fenced. Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
1 parent 01c7a59 commit a7e7ffa

4 files changed

Lines changed: 60 additions & 60 deletions

File tree

fs/dlm/dlm_internal.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ struct dlm_args {
203203
#define DLM_IFL_OVERLAP_CANCEL 0x00100000
204204
#define DLM_IFL_ENDOFLIFE 0x00200000
205205
#define DLM_IFL_DEADLOCK_CANCEL 0x01000000
206-
#define DLM_IFL_STUB_MS 0x02000000 /* magic number for m_flags */
206+
#define DLM_IFL_LOCAL_MS 0x02000000 /* magic number for m_flags */
207207

208208
#define DLM_IFL_CB_PENDING_BIT 0
209209

@@ -593,9 +593,9 @@ struct dlm_ls {
593593
int ls_slots_size;
594594
struct dlm_slot *ls_slots;
595595

596-
struct dlm_rsb ls_stub_rsb; /* for returning errors */
597-
struct dlm_lkb ls_stub_lkb; /* for returning errors */
598-
struct dlm_message ls_stub_ms; /* for faking a reply */
596+
struct dlm_rsb ls_local_rsb; /* for returning errors */
597+
struct dlm_lkb ls_local_lkb; /* for returning errors */
598+
struct dlm_message ls_local_ms; /* for faking a reply */
599599

600600
struct dentry *ls_debug_rsb_dentry; /* debugfs */
601601
struct dentry *ls_debug_waiters_dentry; /* debugfs */

fs/dlm/lock.c

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,18 +1558,18 @@ static int remove_from_waiters(struct dlm_lkb *lkb, int mstype)
15581558
return error;
15591559
}
15601560

1561-
/* Handles situations where we might be processing a "fake" or "stub" reply in
1561+
/* Handles situations where we might be processing a "fake" or "local" reply in
15621562
which we can't try to take waiters_mutex again. */
15631563

15641564
static int remove_from_waiters_ms(struct dlm_lkb *lkb, struct dlm_message *ms)
15651565
{
15661566
struct dlm_ls *ls = lkb->lkb_resource->res_ls;
15671567
int error;
15681568

1569-
if (ms->m_flags != cpu_to_le32(DLM_IFL_STUB_MS))
1569+
if (ms->m_flags != cpu_to_le32(DLM_IFL_LOCAL_MS))
15701570
mutex_lock(&ls->ls_waiters_mutex);
15711571
error = _remove_from_waiters(lkb, le32_to_cpu(ms->m_type), ms);
1572-
if (ms->m_flags != cpu_to_le32(DLM_IFL_STUB_MS))
1572+
if (ms->m_flags != cpu_to_le32(DLM_IFL_LOCAL_MS))
15731573
mutex_unlock(&ls->ls_waiters_mutex);
15741574
return error;
15751575
}
@@ -3486,10 +3486,10 @@ static int send_convert(struct dlm_rsb *r, struct dlm_lkb *lkb)
34863486
/* down conversions go without a reply from the master */
34873487
if (!error && down_conversion(lkb)) {
34883488
remove_from_waiters(lkb, DLM_MSG_CONVERT_REPLY);
3489-
r->res_ls->ls_stub_ms.m_flags = cpu_to_le32(DLM_IFL_STUB_MS);
3490-
r->res_ls->ls_stub_ms.m_type = cpu_to_le32(DLM_MSG_CONVERT_REPLY);
3491-
r->res_ls->ls_stub_ms.m_result = 0;
3492-
__receive_convert_reply(r, lkb, &r->res_ls->ls_stub_ms);
3489+
r->res_ls->ls_local_ms.m_flags = cpu_to_le32(DLM_IFL_LOCAL_MS);
3490+
r->res_ls->ls_local_ms.m_type = cpu_to_le32(DLM_MSG_CONVERT_REPLY);
3491+
r->res_ls->ls_local_ms.m_result = 0;
3492+
__receive_convert_reply(r, lkb, &r->res_ls->ls_local_ms);
34933493
}
34943494

34953495
return error;
@@ -3648,7 +3648,7 @@ static int send_cancel_reply(struct dlm_rsb *r, struct dlm_lkb *lkb, int rv)
36483648
static int send_lookup_reply(struct dlm_ls *ls, struct dlm_message *ms_in,
36493649
int ret_nodeid, int rv)
36503650
{
3651-
struct dlm_rsb *r = &ls->ls_stub_rsb;
3651+
struct dlm_rsb *r = &ls->ls_local_rsb;
36523652
struct dlm_message *ms;
36533653
struct dlm_mhandle *mh;
36543654
int error, nodeid = le32_to_cpu(ms_in->m_header.h_nodeid);
@@ -3681,7 +3681,7 @@ static void receive_flags(struct dlm_lkb *lkb, struct dlm_message *ms)
36813681

36823682
static void receive_flags_reply(struct dlm_lkb *lkb, struct dlm_message *ms)
36833683
{
3684-
if (ms->m_flags == cpu_to_le32(DLM_IFL_STUB_MS))
3684+
if (ms->m_flags == cpu_to_le32(DLM_IFL_LOCAL_MS))
36853685
return;
36863686

36873687
lkb->lkb_sbflags = le32_to_cpu(ms->m_sbflags);
@@ -3768,12 +3768,12 @@ static int receive_unlock_args(struct dlm_ls *ls, struct dlm_lkb *lkb,
37683768
return 0;
37693769
}
37703770

3771-
/* We fill in the stub-lkb fields with the info that send_xxxx_reply()
3771+
/* We fill in the local-lkb fields with the info that send_xxxx_reply()
37723772
uses to send a reply and that the remote end uses to process the reply. */
37733773

3774-
static void setup_stub_lkb(struct dlm_ls *ls, struct dlm_message *ms)
3774+
static void setup_local_lkb(struct dlm_ls *ls, struct dlm_message *ms)
37753775
{
3776-
struct dlm_lkb *lkb = &ls->ls_stub_lkb;
3776+
struct dlm_lkb *lkb = &ls->ls_local_lkb;
37773777
lkb->lkb_nodeid = le32_to_cpu(ms->m_header.h_nodeid);
37783778
lkb->lkb_remid = le32_to_cpu(ms->m_lkid);
37793779
}
@@ -3906,8 +3906,8 @@ static int receive_request(struct dlm_ls *ls, struct dlm_message *ms)
39063906
le32_to_cpu(ms->m_lkid), from_nodeid, error);
39073907
}
39083908

3909-
setup_stub_lkb(ls, ms);
3910-
send_request_reply(&ls->ls_stub_rsb, &ls->ls_stub_lkb, error);
3909+
setup_local_lkb(ls, ms);
3910+
send_request_reply(&ls->ls_local_rsb, &ls->ls_local_lkb, error);
39113911
return error;
39123912
}
39133913

@@ -3962,8 +3962,8 @@ static int receive_convert(struct dlm_ls *ls, struct dlm_message *ms)
39623962
return 0;
39633963

39643964
fail:
3965-
setup_stub_lkb(ls, ms);
3966-
send_convert_reply(&ls->ls_stub_rsb, &ls->ls_stub_lkb, error);
3965+
setup_local_lkb(ls, ms);
3966+
send_convert_reply(&ls->ls_local_rsb, &ls->ls_local_lkb, error);
39673967
return error;
39683968
}
39693969

@@ -4014,8 +4014,8 @@ static int receive_unlock(struct dlm_ls *ls, struct dlm_message *ms)
40144014
return 0;
40154015

40164016
fail:
4017-
setup_stub_lkb(ls, ms);
4018-
send_unlock_reply(&ls->ls_stub_rsb, &ls->ls_stub_lkb, error);
4017+
setup_local_lkb(ls, ms);
4018+
send_unlock_reply(&ls->ls_local_rsb, &ls->ls_local_lkb, error);
40194019
return error;
40204020
}
40214021

@@ -4050,8 +4050,8 @@ static int receive_cancel(struct dlm_ls *ls, struct dlm_message *ms)
40504050
return 0;
40514051

40524052
fail:
4053-
setup_stub_lkb(ls, ms);
4054-
send_cancel_reply(&ls->ls_stub_rsb, &ls->ls_stub_lkb, error);
4053+
setup_local_lkb(ls, ms);
4054+
send_cancel_reply(&ls->ls_local_rsb, &ls->ls_local_lkb, error);
40554055
return error;
40564056
}
40574057

@@ -4403,7 +4403,7 @@ static void _receive_convert_reply(struct dlm_lkb *lkb, struct dlm_message *ms)
44034403
if (error)
44044404
goto out;
44054405

4406-
/* stub reply can happen with waiters_mutex held */
4406+
/* local reply can happen with waiters_mutex held */
44074407
error = remove_from_waiters_ms(lkb, ms);
44084408
if (error)
44094409
goto out;
@@ -4440,7 +4440,7 @@ static void _receive_unlock_reply(struct dlm_lkb *lkb, struct dlm_message *ms)
44404440
if (error)
44414441
goto out;
44424442

4443-
/* stub reply can happen with waiters_mutex held */
4443+
/* local reply can happen with waiters_mutex held */
44444444
error = remove_from_waiters_ms(lkb, ms);
44454445
if (error)
44464446
goto out;
@@ -4490,7 +4490,7 @@ static void _receive_cancel_reply(struct dlm_lkb *lkb, struct dlm_message *ms)
44904490
if (error)
44914491
goto out;
44924492

4493-
/* stub reply can happen with waiters_mutex held */
4493+
/* local reply can happen with waiters_mutex held */
44944494
error = remove_from_waiters_ms(lkb, ms);
44954495
if (error)
44964496
goto out;
@@ -4834,16 +4834,16 @@ void dlm_receive_buffer(union dlm_packet *p, int nodeid)
48344834
}
48354835

48364836
static void recover_convert_waiter(struct dlm_ls *ls, struct dlm_lkb *lkb,
4837-
struct dlm_message *ms_stub)
4837+
struct dlm_message *ms_local)
48384838
{
48394839
if (middle_conversion(lkb)) {
48404840
hold_lkb(lkb);
4841-
memset(ms_stub, 0, sizeof(struct dlm_message));
4842-
ms_stub->m_flags = cpu_to_le32(DLM_IFL_STUB_MS);
4843-
ms_stub->m_type = cpu_to_le32(DLM_MSG_CONVERT_REPLY);
4844-
ms_stub->m_result = cpu_to_le32(to_dlm_errno(-EINPROGRESS));
4845-
ms_stub->m_header.h_nodeid = cpu_to_le32(lkb->lkb_nodeid);
4846-
_receive_convert_reply(lkb, ms_stub);
4841+
memset(ms_local, 0, sizeof(struct dlm_message));
4842+
ms_local->m_flags = cpu_to_le32(DLM_IFL_LOCAL_MS);
4843+
ms_local->m_type = cpu_to_le32(DLM_MSG_CONVERT_REPLY);
4844+
ms_local->m_result = cpu_to_le32(to_dlm_errno(-EINPROGRESS));
4845+
ms_local->m_header.h_nodeid = cpu_to_le32(lkb->lkb_nodeid);
4846+
_receive_convert_reply(lkb, ms_local);
48474847

48484848
/* Same special case as in receive_rcom_lock_args() */
48494849
lkb->lkb_grmode = DLM_LOCK_IV;
@@ -4882,12 +4882,12 @@ static int waiter_needs_recovery(struct dlm_ls *ls, struct dlm_lkb *lkb,
48824882
void dlm_recover_waiters_pre(struct dlm_ls *ls)
48834883
{
48844884
struct dlm_lkb *lkb, *safe;
4885-
struct dlm_message *ms_stub;
4886-
int wait_type, stub_unlock_result, stub_cancel_result;
4885+
struct dlm_message *ms_local;
4886+
int wait_type, local_unlock_result, local_cancel_result;
48874887
int dir_nodeid;
48884888

4889-
ms_stub = kmalloc(sizeof(*ms_stub), GFP_KERNEL);
4890-
if (!ms_stub)
4889+
ms_local = kmalloc(sizeof(*ms_local), GFP_KERNEL);
4890+
if (!ms_local)
48914891
return;
48924892

48934893
mutex_lock(&ls->ls_waiters_mutex);
@@ -4923,8 +4923,8 @@ void dlm_recover_waiters_pre(struct dlm_ls *ls)
49234923
continue;
49244924

49254925
wait_type = lkb->lkb_wait_type;
4926-
stub_unlock_result = -DLM_EUNLOCK;
4927-
stub_cancel_result = -DLM_ECANCEL;
4926+
local_unlock_result = -DLM_EUNLOCK;
4927+
local_cancel_result = -DLM_ECANCEL;
49284928

49294929
/* Main reply may have been received leaving a zero wait_type,
49304930
but a reply for the overlapping op may not have been
@@ -4935,17 +4935,17 @@ void dlm_recover_waiters_pre(struct dlm_ls *ls)
49354935
if (is_overlap_cancel(lkb)) {
49364936
wait_type = DLM_MSG_CANCEL;
49374937
if (lkb->lkb_grmode == DLM_LOCK_IV)
4938-
stub_cancel_result = 0;
4938+
local_cancel_result = 0;
49394939
}
49404940
if (is_overlap_unlock(lkb)) {
49414941
wait_type = DLM_MSG_UNLOCK;
49424942
if (lkb->lkb_grmode == DLM_LOCK_IV)
4943-
stub_unlock_result = -ENOENT;
4943+
local_unlock_result = -ENOENT;
49444944
}
49454945

49464946
log_debug(ls, "rwpre overlap %x %x %d %d %d",
49474947
lkb->lkb_id, lkb->lkb_flags, wait_type,
4948-
stub_cancel_result, stub_unlock_result);
4948+
local_cancel_result, local_unlock_result);
49494949
}
49504950

49514951
switch (wait_type) {
@@ -4955,28 +4955,28 @@ void dlm_recover_waiters_pre(struct dlm_ls *ls)
49554955
break;
49564956

49574957
case DLM_MSG_CONVERT:
4958-
recover_convert_waiter(ls, lkb, ms_stub);
4958+
recover_convert_waiter(ls, lkb, ms_local);
49594959
break;
49604960

49614961
case DLM_MSG_UNLOCK:
49624962
hold_lkb(lkb);
4963-
memset(ms_stub, 0, sizeof(struct dlm_message));
4964-
ms_stub->m_flags = cpu_to_le32(DLM_IFL_STUB_MS);
4965-
ms_stub->m_type = cpu_to_le32(DLM_MSG_UNLOCK_REPLY);
4966-
ms_stub->m_result = cpu_to_le32(to_dlm_errno(stub_unlock_result));
4967-
ms_stub->m_header.h_nodeid = cpu_to_le32(lkb->lkb_nodeid);
4968-
_receive_unlock_reply(lkb, ms_stub);
4963+
memset(ms_local, 0, sizeof(struct dlm_message));
4964+
ms_local->m_flags = cpu_to_le32(DLM_IFL_LOCAL_MS);
4965+
ms_local->m_type = cpu_to_le32(DLM_MSG_UNLOCK_REPLY);
4966+
ms_local->m_result = cpu_to_le32(to_dlm_errno(local_unlock_result));
4967+
ms_local->m_header.h_nodeid = cpu_to_le32(lkb->lkb_nodeid);
4968+
_receive_unlock_reply(lkb, ms_local);
49694969
dlm_put_lkb(lkb);
49704970
break;
49714971

49724972
case DLM_MSG_CANCEL:
49734973
hold_lkb(lkb);
4974-
memset(ms_stub, 0, sizeof(struct dlm_message));
4975-
ms_stub->m_flags = cpu_to_le32(DLM_IFL_STUB_MS);
4976-
ms_stub->m_type = cpu_to_le32(DLM_MSG_CANCEL_REPLY);
4977-
ms_stub->m_result = cpu_to_le32(to_dlm_errno(stub_cancel_result));
4978-
ms_stub->m_header.h_nodeid = cpu_to_le32(lkb->lkb_nodeid);
4979-
_receive_cancel_reply(lkb, ms_stub);
4974+
memset(ms_local, 0, sizeof(struct dlm_message));
4975+
ms_local->m_flags = cpu_to_le32(DLM_IFL_LOCAL_MS);
4976+
ms_local->m_type = cpu_to_le32(DLM_MSG_CANCEL_REPLY);
4977+
ms_local->m_result = cpu_to_le32(to_dlm_errno(local_cancel_result));
4978+
ms_local->m_header.h_nodeid = cpu_to_le32(lkb->lkb_nodeid);
4979+
_receive_cancel_reply(lkb, ms_local);
49804980
dlm_put_lkb(lkb);
49814981
break;
49824982

@@ -4987,7 +4987,7 @@ void dlm_recover_waiters_pre(struct dlm_ls *ls)
49874987
schedule();
49884988
}
49894989
mutex_unlock(&ls->ls_waiters_mutex);
4990-
kfree(ms_stub);
4990+
kfree(ms_local);
49914991
}
49924992

49934993
static struct dlm_lkb *find_resend_waiter(struct dlm_ls *ls)

fs/dlm/lockspace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,8 +529,8 @@ static int new_lockspace(const char *name, const char *cluster,
529529
ls->ls_total_weight = 0;
530530
ls->ls_node_array = NULL;
531531

532-
memset(&ls->ls_stub_rsb, 0, sizeof(struct dlm_rsb));
533-
ls->ls_stub_rsb.res_ls = ls;
532+
memset(&ls->ls_local_rsb, 0, sizeof(struct dlm_rsb));
533+
ls->ls_local_rsb.res_ls = ls;
534534

535535
ls->ls_debug_rsb_dentry = NULL;
536536
ls->ls_debug_waiters_dentry = NULL;

include/trace/events/dlm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
{ DLM_IFL_OVERLAP_CANCEL, "OVERLAP_CANCEL" }, \
5555
{ DLM_IFL_ENDOFLIFE, "ENDOFLIFE" }, \
5656
{ DLM_IFL_DEADLOCK_CANCEL, "DEADLOCK_CANCEL" }, \
57-
{ DLM_IFL_STUB_MS, "STUB_MS" }, \
57+
{ DLM_IFL_LOCAL_MS, "LOCAL_MS" }, \
5858
{ DLM_IFL_USER, "USER" }, \
5959
{ DLM_IFL_ORPHAN, "ORPHAN" })
6060

0 commit comments

Comments
 (0)