lock.c (c4f4e135c27b503d325d414819831909023b113d) lock.c (b9d2f6ada0083bad46f37a1238fea718b575e0fa)
1// SPDX-License-Identifier: GPL-2.0-only
2/******************************************************************************
3*******************************************************************************
4**
5** Copyright (C) 2005-2010 Red Hat, Inc. All rights reserved.
6**
7**
8*******************************************************************************

--- 5370 unchanged lines hidden (view full) ---

5379
5380/* This lkb may have been recovered in a previous aborted recovery so we need
5381 to check if the rsb already has an lkb with the given remote nodeid/lkid.
5382 If so we just send back a standard reply. If not, we create a new lkb with
5383 the given values and send back our lkid. We send back our lkid by sending
5384 back the rcom_lock struct we got but with the remid field filled in. */
5385
5386/* needs at least dlm_rcom + rcom_lock */
1// SPDX-License-Identifier: GPL-2.0-only
2/******************************************************************************
3*******************************************************************************
4**
5** Copyright (C) 2005-2010 Red Hat, Inc. All rights reserved.
6**
7**
8*******************************************************************************

--- 5370 unchanged lines hidden (view full) ---

5379
5380/* This lkb may have been recovered in a previous aborted recovery so we need
5381 to check if the rsb already has an lkb with the given remote nodeid/lkid.
5382 If so we just send back a standard reply. If not, we create a new lkb with
5383 the given values and send back our lkid. We send back our lkid by sending
5384 back the rcom_lock struct we got but with the remid field filled in. */
5385
5386/* needs at least dlm_rcom + rcom_lock */
5387int dlm_recover_master_copy(struct dlm_ls *ls, struct dlm_rcom *rc)
5387int dlm_recover_master_copy(struct dlm_ls *ls, struct dlm_rcom *rc,
5388 __le32 *rl_remid, __le32 *rl_result)
5388{
5389 struct rcom_lock *rl = (struct rcom_lock *) rc->rc_buf;
5390 struct dlm_rsb *r;
5391 struct dlm_lkb *lkb;
5392 uint32_t remid = 0;
5393 int from_nodeid = le32_to_cpu(rc->rc_header.h_nodeid);
5394 int error;
5395
5389{
5390 struct rcom_lock *rl = (struct rcom_lock *) rc->rc_buf;
5391 struct dlm_rsb *r;
5392 struct dlm_lkb *lkb;
5393 uint32_t remid = 0;
5394 int from_nodeid = le32_to_cpu(rc->rc_header.h_nodeid);
5395 int error;
5396
5397 /* init rl_remid with rcom lock rl_remid */
5398 *rl_remid = rl->rl_remid;
5399
5396 if (rl->rl_parent_lkid) {
5397 error = -EOPNOTSUPP;
5398 goto out;
5399 }
5400
5401 remid = le32_to_cpu(rl->rl_lkid);
5402
5403 /* In general we expect the rsb returned to be R_MASTER, but we don't

--- 39 unchanged lines hidden (view full) ---

5443 ls->ls_recover_locks_in++;
5444
5445 if (!list_empty(&r->res_waitqueue) || !list_empty(&r->res_convertqueue))
5446 rsb_set_flag(r, RSB_RECOVER_GRANT);
5447
5448 out_remid:
5449 /* this is the new value returned to the lock holder for
5450 saving in its process-copy lkb */
5400 if (rl->rl_parent_lkid) {
5401 error = -EOPNOTSUPP;
5402 goto out;
5403 }
5404
5405 remid = le32_to_cpu(rl->rl_lkid);
5406
5407 /* In general we expect the rsb returned to be R_MASTER, but we don't

--- 39 unchanged lines hidden (view full) ---

5447 ls->ls_recover_locks_in++;
5448
5449 if (!list_empty(&r->res_waitqueue) || !list_empty(&r->res_convertqueue))
5450 rsb_set_flag(r, RSB_RECOVER_GRANT);
5451
5452 out_remid:
5453 /* this is the new value returned to the lock holder for
5454 saving in its process-copy lkb */
5451 rl->rl_remid = cpu_to_le32(lkb->lkb_id);
5455 *rl_remid = cpu_to_le32(lkb->lkb_id);
5452
5453 lkb->lkb_recover_seq = ls->ls_recover_seq;
5454
5455 out_unlock:
5456 unlock_rsb(r);
5457 put_rsb(r);
5458 out:
5459 if (error && error != -EEXIST)
5460 log_rinfo(ls, "dlm_recover_master_copy remote %d %x error %d",
5461 from_nodeid, remid, error);
5456
5457 lkb->lkb_recover_seq = ls->ls_recover_seq;
5458
5459 out_unlock:
5460 unlock_rsb(r);
5461 put_rsb(r);
5462 out:
5463 if (error && error != -EEXIST)
5464 log_rinfo(ls, "dlm_recover_master_copy remote %d %x error %d",
5465 from_nodeid, remid, error);
5462 rl->rl_result = cpu_to_le32(error);
5466 *rl_result = cpu_to_le32(error);
5463 return error;
5464}
5465
5466/* needs at least dlm_rcom + rcom_lock */
5467int dlm_recover_process_copy(struct dlm_ls *ls, struct dlm_rcom *rc,
5468 uint64_t seq)
5469{
5470 struct rcom_lock *rl = (struct rcom_lock *) rc->rc_buf;

--- 672 unchanged lines hidden ---
5467 return error;
5468}
5469
5470/* needs at least dlm_rcom + rcom_lock */
5471int dlm_recover_process_copy(struct dlm_ls *ls, struct dlm_rcom *rc,
5472 uint64_t seq)
5473{
5474 struct rcom_lock *rl = (struct rcom_lock *) rc->rc_buf;

--- 672 unchanged lines hidden ---