Skip to content

Commit b434eda

Browse files
Patrick Caulfieldswhiteho
authored andcommitted
[DLM] don't overwrite castparam if it's NULL
If the castaddr passed to the userland API is NULL then don't overwrite the existing castparam. This allows a different thread to cancel a lock request and the CANCEL AST gets delivered to the original thread. bz#306391 (for RHEL4) refers. Signed-Off-By: Patrick Caulfield <pcaulfie@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
1 parent 5a60c53 commit b434eda

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎fs/dlm/lock.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4429,7 +4429,8 @@ int dlm_user_unlock(struct dlm_ls *ls, struct dlm_user_args *ua_tmp,
44294429

44304430
if (lvb_in && ua->lksb.sb_lvbptr)
44314431
memcpy(ua->lksb.sb_lvbptr, lvb_in, DLM_USER_LVB_LEN);
4432-
ua->castparam = ua_tmp->castparam;
4432+
if (ua_tmp->castparam)
4433+
ua->castparam = ua_tmp->castparam;
44334434
ua->user_lksb = ua_tmp->user_lksb;
44344435

44354436
error = set_unlock_args(flags, ua, &args);
@@ -4474,7 +4475,8 @@ int dlm_user_cancel(struct dlm_ls *ls, struct dlm_user_args *ua_tmp,
44744475
goto out;
44754476

44764477
ua = (struct dlm_user_args *)lkb->lkb_astparam;
4477-
ua->castparam = ua_tmp->castparam;
4478+
if (ua_tmp->castparam)
4479+
ua->castparam = ua_tmp->castparam;
44784480
ua->user_lksb = ua_tmp->user_lksb;
44794481

44804482
error = set_unlock_args(flags, ua, &args);

0 commit comments

Comments
 (0)