diff --git a/scst/src/scst_dlm.c b/scst/src/scst_dlm.c index 5b4f79cf5..65fe76c9f 100644 --- a/scst/src/scst_dlm.c +++ b/scst/src/scst_dlm.c @@ -356,6 +356,10 @@ static int scst_copy_from_dlm(struct scst_device *dev, dlm_lockspace_t *ls, if (reg->lksb.lksb.sb_lkid == 0) scst_pr_remove_registrant(dev, reg); +#ifndef CONFIG_SCST_PROC + scst_pr_sync_device_file(dev); +#endif + scst_pr_write_unlock(dev); res = 0; @@ -1363,9 +1367,15 @@ create_st_wq(const char *fmt, ...) static int scst_pr_dlm_init(struct scst_device *dev, const char *cl_dev_id) { struct scst_pr_dlm_data *pr_dlm; + struct scst_dev_registrant *reg; int res = -ENOMEM; compile_time_size_checks(); + + list_for_each_entry(reg, &dev->dev_registrants_list, + dev_registrants_list_entry) + scst_dlm_pr_init_reg(dev, reg); + pr_dlm = kzalloc(sizeof(*dev->pr_dlm), GFP_KERNEL); if (!pr_dlm) goto out; diff --git a/scst/src/scst_pres.c b/scst/src/scst_pres.c index 5ac78d112..1627e792d 100644 --- a/scst/src/scst_pres.c +++ b/scst/src/scst_pres.c @@ -870,10 +870,8 @@ out: return res; } -static void scst_pr_remove_device_files(struct scst_tgt_dev *tgt_dev) +static void scst_pr_remove_device_files(struct scst_device *dev) { - struct scst_device *dev = tgt_dev->dev; - TRACE_ENTRY(); scst_assert_pr_mutex_held(dev); @@ -888,10 +886,9 @@ static void scst_pr_remove_device_files(struct scst_tgt_dev *tgt_dev) } /* Must be called under dev_pr_mutex */ -void scst_pr_sync_device_file(struct scst_tgt_dev *tgt_dev, struct scst_cmd *cmd) +void scst_pr_sync_device_file(struct scst_device *dev) { int res = 0; - struct scst_device *dev = tgt_dev->dev; struct file *file; mm_segment_t old_fs = get_fs(); loff_t pos = 0; @@ -905,7 +902,7 @@ void scst_pr_sync_device_file(struct scst_tgt_dev *tgt_dev, struct scst_cmd *cmd scst_assert_pr_mutex_held(dev); if ((dev->pr_aptpl == 0) || list_empty(&dev->dev_registrants_list)) { - scst_pr_remove_device_files(tgt_dev); + scst_pr_remove_device_files(dev); goto out; } @@ -1022,21 +1019,9 @@ out_set_fs: set_fs(old_fs); out: - if (res != 0) { + if (res != 0) PRINT_CRIT_ERROR("Unable to save persistent information " - "(target %s, initiator %s, device %s)", - tgt_dev->sess->tgt->tgt_name, - tgt_dev->sess->initiator_name, dev->virt_name); -#if 0 /* - * Looks like it's safer to return SUCCESS and expect operator's - * intervention to be able to save the PR's state next time, than - * to return HARDWARE ERROR and screw up all the interaction with - * the affected initiator. - */ - if (cmd != NULL) - scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_internal_failure)); -#endif - } + "(device %s)", dev->virt_name); TRACE_EXIT_RES(res); return; diff --git a/scst/src/scst_pres.h b/scst/src/scst_pres.h index 94a69f379..81f432964 100644 --- a/scst/src/scst_pres.h +++ b/scst/src/scst_pres.h @@ -148,7 +148,7 @@ void scst_pr_set_holder(struct scst_device *dev, void scst_pr_clear_holder(struct scst_device *dev); #ifndef CONFIG_SCST_PROC -void scst_pr_sync_device_file(struct scst_tgt_dev *tgt_dev, struct scst_cmd *cmd); +void scst_pr_sync_device_file(struct scst_device *dev); #endif #if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING) diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 20ea82945..7c4165276 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -3157,7 +3157,7 @@ static int scst_persistent_reserve_out_local(struct scst_cmd *cmd) #ifndef CONFIG_SCST_PROC if (cmd->status == SAM_STAT_GOOD) - scst_pr_sync_device_file(tgt_dev, cmd); + scst_pr_sync_device_file(dev); #endif if ((cmd->devt->pr_cmds_notifications) &&