Skip to content

Commit 32f105a

Browse files
teiglandswhiteho
authored andcommitted
[DLM] down conversion clearing flags
The down-conversion optimization was resulting in the lkb flags being cleared because the stub message reply had no flags value set. Copy the current flags into the stub message so they'll be copied back into the lkb as part of processing the fake reply. Also add an assertion to catch this error more directly if it exists elsewhere. Signed-off-by: David Teigland <teigland@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
1 parent c059f70 commit 32f105a

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

‎fs/dlm/ast.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ void dlm_add_ast(struct dlm_lkb *lkb, int type)
3838
dlm_user_add_ast(lkb, type);
3939
return;
4040
}
41+
DLM_ASSERT(lkb->lkb_astaddr != DLM_FAKE_USER_AST, dlm_print_lkb(lkb););
4142

4243
spin_lock(&ast_queue_lock);
4344
if (!(lkb->lkb_ast_type & (AST_COMP | AST_BAST))) {

‎fs/dlm/dlm_internal.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ struct dlm_mhandle;
9191
} \
9292
}
9393

94+
#define DLM_FAKE_USER_AST ERR_PTR(-EINVAL)
95+
9496

9597
struct dlm_direntry {
9698
struct list_head list;

‎fs/dlm/lock.c‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ static void __receive_convert_reply(struct dlm_rsb *r, struct dlm_lkb *lkb,
8686
struct dlm_message *ms);
8787
static int receive_extralen(struct dlm_message *ms);
8888

89-
#define FAKE_USER_AST (void*)0xff00ff00
90-
9189
/*
9290
* Lock compatibilty matrix - thanks Steve
9391
* UN = Unlocked state. Not really a state, used as a flag
@@ -2195,6 +2193,7 @@ static int send_convert(struct dlm_rsb *r, struct dlm_lkb *lkb)
21952193
if (!error && down_conversion(lkb)) {
21962194
remove_from_waiters(lkb);
21972195
r->res_ls->ls_stub_ms.m_result = 0;
2196+
r->res_ls->ls_stub_ms.m_flags = lkb->lkb_flags;
21982197
__receive_convert_reply(r, lkb, &r->res_ls->ls_stub_ms);
21992198
}
22002199

@@ -3615,7 +3614,7 @@ int dlm_user_request(struct dlm_ls *ls, struct dlm_user_args *ua,
36153614
lock and that lkb_astparam is the dlm_user_args structure. */
36163615

36173616
error = set_lock_args(mode, &ua->lksb, flags, namelen, parent_lkid,
3618-
FAKE_USER_AST, ua, FAKE_USER_AST, &args);
3617+
DLM_FAKE_USER_AST, ua, DLM_FAKE_USER_AST, &args);
36193618
lkb->lkb_flags |= DLM_IFL_USER;
36203619
ua->old_mode = DLM_LOCK_IV;
36213620

@@ -3686,8 +3685,8 @@ int dlm_user_convert(struct dlm_ls *ls, struct dlm_user_args *ua_tmp,
36863685
ua->user_lksb = ua_tmp->user_lksb;
36873686
ua->old_mode = lkb->lkb_grmode;
36883687

3689-
error = set_lock_args(mode, &ua->lksb, flags, 0, 0, FAKE_USER_AST, ua,
3690-
FAKE_USER_AST, &args);
3688+
error = set_lock_args(mode, &ua->lksb, flags, 0, 0, DLM_FAKE_USER_AST,
3689+
ua, DLM_FAKE_USER_AST, &args);
36913690
if (error)
36923691
goto out_put;
36933692

0 commit comments

Comments
 (0)