Print this page
NEX-4433 Deadlock among txg_wait_synced(), sbd_pgr_remove_it_handle(), and ppt_sess_lookup_create() after HA failover
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Bayard Bell <bayard.bell@nexenta.com>
NEX-3111 Comstar does not pass cstyle and hdrchk
        Reviewed by: Jean McCormack <jean.mccormack@nexenta.com>
        Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
        Reviewed by: Tony Nguyen <tony.nguyen@nexenta.com>
SUP-765 When a Windows Clustered Shared Volume is placed on a pool under Nexenta HA Cluster control the clustered shared disk looses its PGR3 reservation to the presented zvol.
Reviewed by: Bayard Bell <bayard.bell@nexenta.com>
Reviewed by: Tony Nguyen <tony.nguyen@nexenta.com>
Reviewed by: Josef Sipek <josef.sipek@nexenta.com>
Re #6790 backspace should perform delete on console
VAAI (XXX ATS support for COMSTAR, YYY Block-copy support for COMSTAR)

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd_pgr.c
          +++ new/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd_pgr.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
       23 + *
       24 + * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  23   25   */
  24   26  
  25   27  #include <sys/atomic.h>
  26   28  #include <sys/conf.h>
  27   29  #include <sys/byteorder.h>
  28   30  #include <sys/scsi/scsi_types.h>
  29   31  #include <sys/scsi/generic/persist.h>
  30   32  
  31   33  #include <sys/lpif.h>
  32   34  #include <sys/stmf.h>
  33   35  #include <sys/stmf_ioctl.h>
  34   36  #include <sys/portif.h>
  35   37  #include <sys/stmf_sbd_ioctl.h>
  36   38  
  37   39  #include "stmf_sbd.h"
  38   40  #include "sbd_impl.h"
  39   41  
  40   42  #define MAX_PGR_PARAM_LIST_LENGTH       (256 * 1024)
  41   43  
  42      -int  sbd_pgr_reservation_conflict(scsi_task_t *);
       44 +int  sbd_pgr_reservation_conflict(scsi_task_t *, struct sbd_lu *sl);
  43   45  void sbd_pgr_reset(sbd_lu_t *);
  44   46  void sbd_pgr_initialize_it(scsi_task_t *, sbd_it_data_t *);
  45   47  void sbd_handle_pgr_in_cmd(scsi_task_t *, stmf_data_buf_t *);
  46   48  void sbd_handle_pgr_out_cmd(scsi_task_t *, stmf_data_buf_t *);
  47   49  void sbd_handle_pgr_out_data(scsi_task_t *, stmf_data_buf_t *);
  48   50  void sbd_pgr_keylist_dealloc(sbd_lu_t *);
  49   51  char *sbd_get_devid_string(sbd_lu_t *);
  50   52  
  51   53  sbd_status_t sbd_pgr_meta_init(sbd_lu_t *);
  52   54  sbd_status_t sbd_pgr_meta_load(sbd_lu_t *);
↓ open down ↓ 22 lines elided ↑ open up ↑
  75   77  static void sbd_pgr_out_preempt(scsi_task_t *, stmf_data_buf_t *);
  76   78  static void sbd_pgr_out_register_and_move(scsi_task_t *, stmf_data_buf_t *);
  77   79  
  78   80  static sbd_pgr_key_t *sbd_pgr_do_register(sbd_lu_t *, sbd_it_data_t *,
  79   81          scsi_devid_desc_t *, stmf_remote_port_t *, uint8_t, uint64_t);
  80   82  static void sbd_pgr_do_unregister(sbd_lu_t *, sbd_it_data_t *, sbd_pgr_key_t *);
  81   83  static void sbd_pgr_do_release(sbd_lu_t *, sbd_it_data_t *, uint8_t);
  82   84  static void sbd_pgr_do_reserve(sbd_pgr_t *, sbd_pgr_key_t *, sbd_it_data_t *it,
  83   85          stmf_scsi_session_t *, scsi_cdb_prout_t *);
  84   86  
       87 +static boolean_t sbd_pgr_should_save(sbd_lu_t *);
  85   88  extern sbd_status_t sbd_write_meta_section(sbd_lu_t *, sm_section_hdr_t *);
  86   89  extern sbd_status_t sbd_read_meta_section(sbd_lu_t *, sm_section_hdr_t **,
  87   90          uint16_t);
  88   91  extern void sbd_swap_section_hdr(sm_section_hdr_t *);
  89   92  extern void sbd_handle_short_write_transfers(scsi_task_t *task,
  90   93          stmf_data_buf_t *dbuf, uint32_t cdb_xfer_size);
  91   94  extern void sbd_handle_short_read_transfers(scsi_task_t *task,
  92   95          stmf_data_buf_t *dbuf, uint8_t *p, uint32_t cdb_xfer_size,
  93   96          uint32_t cmd_xfer_size);
  94   97  extern uint16_t stmf_scsilib_get_lport_rtid(scsi_devid_desc_t *devid);
↓ open down ↓ 193 lines elided ↑ open up ↑
 288  291          spi->pgr_data_order = SMS_DATA_ORDER;
 289  292          spi->pgr_sms_header.sms_size = sz;
 290  293          spi->pgr_sms_header.sms_id = SMS_ID_PGR_INFO;
 291  294          spi->pgr_sms_header.sms_data_order = SMS_DATA_ORDER;
 292  295  
 293  296          ret = sbd_write_meta_section(slu, (sm_section_hdr_t *)spi);
 294  297          kmem_free(spi, sz);
 295  298          return (ret);
 296  299  }
 297  300  
      301 +/*
      302 + * Evaluate common cases where a PERSISTENT RESERVE OUT CDB handler should call
      303 + * sbd_pgr_meta_write().
      304 + */
      305 +static boolean_t
      306 +sbd_pgr_should_save(sbd_lu_t *slu)
      307 +{
      308 +        sbd_pgr_t               *pgr = slu->sl_pgr;
      309 +
      310 +        if (stmf_is_pgr_aptpl_always() == B_TRUE ||
      311 +            (pgr->pgr_flags & (SBD_PGR_APTPL)))
      312 +                return (B_TRUE);
      313 +        else
      314 +                return (B_FALSE);
      315 +}
      316 +
 298  317  sbd_status_t
 299  318  sbd_pgr_meta_load(sbd_lu_t *slu)
 300  319  {
 301  320          sbd_pgr_t               *pgr = slu->sl_pgr;
 302  321          sbd_pgr_info_t          *spi = NULL;
 303  322          sbd_pgr_key_t           *key, *last_key = NULL;
 304  323          sbd_pgr_key_info_t      *spi_key;
 305  324          sbd_status_t            ret = SBD_SUCCESS;
 306  325          scsi_devid_desc_t       *lpt;
 307  326          uint8_t                 *ptr, *keyoffset,  *endoffset;
↓ open down ↓ 8 lines elided ↑ open up ↑
 316  335                          ret = sbd_pgr_meta_init(slu);
 317  336                  }
 318  337                  return (ret);
 319  338          }
 320  339  
 321  340          if (spi->pgr_data_order != SMS_DATA_ORDER) {
 322  341                  sbd_swap_pgr_info(spi);
 323  342          }
 324  343  
 325  344          pgr->pgr_flags = spi->pgr_flags;
 326      -        if (pgr->pgr_flags & SBD_PGR_APTPL) {
      345 +        /*
      346 +         * We reload APTPL reservations when:
      347 +         *  1. Global override is enabled
      348 +         *  2. APTPL was explicitly asserted in the PERSISTENT RESERVE OUT CDB
      349 +         */
      350 +        if (stmf_is_pgr_aptpl_always() || (pgr->pgr_flags & SBD_PGR_APTPL)) {
 327  351                  pgr->pgr_rsv_type = spi->pgr_rsv_type;
 328  352                  pgr->pgr_rsv_scope = spi->pgr_rsv_scope;
 329  353          } else {
 330  354                  PGR_CLEAR_RSV_FLAG(pgr->pgr_flags);
 331  355          }
 332  356  
 333  357          PGR_CLEAR_FLAG(slu->sl_pgr->pgr_flags, SBD_PGR_ALL_KEYS_HAS_IT);
 334  358  
 335  359          endoffset       = (uint8_t *)spi;
 336  360          endoffset       += spi->pgr_sms_header.sms_size;
↓ open down ↓ 69 lines elided ↑ open up ↑
 406  430                  if ((pgr->pgr_flags & SBD_PGR_RSVD_ONE) &&
 407  431                      (i == spi->pgr_rsvholder_indx)) {
 408  432                          pgr->pgr_rsvholder = key;
 409  433                  }
 410  434          }
 411  435  
 412  436          kmem_free(spi, spi->pgr_sms_header.sms_size);
 413  437          return (ret);
 414  438  
 415  439  sbd_pgr_meta_load_failed:
      440 +        /* CSTYLED */
 416  441          {
 417  442          char *lun_name = sbd_get_devid_string(slu);
 418  443          sbd_pgr_keylist_dealloc(slu);
 419  444          kmem_free(spi, spi->pgr_sms_header.sms_size);
 420  445          cmn_err(CE_WARN, "sbd_pgr_meta_load: Failed to load PGR meta data "
 421  446              "for lun %s.", lun_name);
 422  447          kmem_free(lun_name, strlen(lun_name) + 1);
 423  448          return (ret);
 424  449          }
 425  450  }
↓ open down ↓ 3 lines elided ↑ open up ↑
 429  454  {
 430  455          sbd_pgr_key_t           *key;
 431  456          sbd_pgr_info_t          *spi;
 432  457          sbd_pgr_key_info_t      *spi_key;
 433  458          sbd_pgr_t               *pgr = slu->sl_pgr;
 434  459          sbd_status_t            ret = SBD_SUCCESS;
 435  460          uint32_t                sz, totalsz;
 436  461  
 437  462          /* Calculate total pgr meta section size needed */
 438  463          sz = sizeof (sbd_pgr_info_t);
 439      -        if (pgr->pgr_flags & SBD_PGR_APTPL) {
      464 +        if ((pgr->pgr_flags & SBD_PGR_APTPL) || stmf_is_pgr_aptpl_always()) {
 440  465                  key = pgr->pgr_keylist;
 441  466                  while (key != NULL) {
 442  467                          sz = ALIGNED_TO_8BYTE_BOUNDARY(sz +
 443  468                              sizeof (sbd_pgr_key_info_t) - 1 +
 444  469                              key->pgr_key_lpt_len + key->pgr_key_rpt_len);
 445  470                          key = key->pgr_key_next;
 446  471                  }
 447  472          }
 448  473          totalsz = sz;
 449  474  
↓ open down ↓ 1 lines elided ↑ open up ↑
 451  476          spi->pgr_flags          = pgr->pgr_flags;
 452  477          spi->pgr_rsv_type       = pgr->pgr_rsv_type;
 453  478          spi->pgr_rsv_scope      = pgr->pgr_rsv_scope;
 454  479          spi->pgr_data_order     = SMS_DATA_ORDER;
 455  480          spi->pgr_numkeys        = 0;
 456  481  
 457  482          spi->pgr_sms_header.sms_size = totalsz;
 458  483          spi->pgr_sms_header.sms_id = SMS_ID_PGR_INFO;
 459  484          spi->pgr_sms_header.sms_data_order = SMS_DATA_ORDER;
 460  485  
 461      -        if (pgr->pgr_flags & SBD_PGR_APTPL) {
      486 +        if ((pgr->pgr_flags & SBD_PGR_APTPL) || stmf_is_pgr_aptpl_always()) {
 462  487                  uint8_t *ptr;
 463  488                  key = pgr->pgr_keylist;
 464  489                  sz = sizeof (sbd_pgr_info_t);
 465  490                  while (key != NULL) {
 466  491                          spi_key = (sbd_pgr_key_info_t *)((uint8_t *)spi + sz);
 467  492                          spi_key->pgr_key = key->pgr_key;
 468  493                          spi_key->pgr_key_flags = key->pgr_key_flags;
 469  494                          spi_key->pgr_key_lpt_len = key->pgr_key_lpt_len;
 470  495                          spi_key->pgr_key_rpt_len = key->pgr_key_rpt_len;
 471  496                          ptr = spi_key->pgr_key_it;
↓ open down ↓ 5 lines elided ↑ open up ↑
 477  502                          if (key == pgr->pgr_rsvholder) {
 478  503                                  spi->pgr_rsvholder_indx = spi->pgr_numkeys;
 479  504                          }
 480  505  
 481  506                          sz = ALIGNED_TO_8BYTE_BOUNDARY(sz +
 482  507                              sizeof (sbd_pgr_key_info_t) - 1 +
 483  508                              key->pgr_key_lpt_len + key->pgr_key_rpt_len);
 484  509                          key = key->pgr_key_next;
 485  510                  }
 486  511          }
 487      -
      512 +        rw_downgrade(&pgr->pgr_lock);
 488  513          ret = sbd_write_meta_section(slu, (sm_section_hdr_t *)spi);
      514 +        if (!rw_tryupgrade(&pgr->pgr_lock)) {
      515 +                rw_exit(&pgr->pgr_lock);
      516 +                rw_enter(&pgr->pgr_lock, RW_WRITER);
      517 +        }
 489  518          kmem_free(spi, totalsz);
 490  519          if (ret != SBD_SUCCESS) {
 491  520                  sbd_pgr_key_t   *tmp_list;
 492  521                  tmp_list = pgr->pgr_keylist;
 493  522                  pgr->pgr_keylist = NULL;
 494  523                  if (sbd_pgr_meta_load(slu) != SBD_SUCCESS) {
 495  524                          char *lun_name = sbd_get_devid_string(slu);
 496  525                          cmn_err(CE_WARN, "sbd_pgr_meta_write: Failed to revert "
 497  526                              "back to existing PGR state after meta write "
 498  527                              "failure, may cause PGR inconsistancy for lun %s.",
↓ open down ↓ 72 lines elided ↑ open up ↑
 571  600  
 572  601  /*
 573  602   * Reset and clear the keys, Can be used in the case of Lun Reset
 574  603   */
 575  604  void
 576  605  sbd_pgr_reset(sbd_lu_t *slu)
 577  606  {
 578  607          sbd_pgr_t       *pgr  = slu->sl_pgr;
 579  608  
 580  609          rw_enter(&pgr->pgr_lock, RW_WRITER);
 581      -        if (!(pgr->pgr_flags & SBD_PGR_APTPL)) {
      610 +        if (!(pgr->pgr_flags & SBD_PGR_APTPL) &&
      611 +            stmf_is_pgr_aptpl_always() == B_FALSE) {
 582  612                  sbd_pgr_keylist_dealloc(slu);
 583  613                  pgr->pgr_PRgeneration   = 0;
 584  614                  pgr->pgr_rsvholder      = NULL;
 585  615                  pgr->pgr_rsv_type       = 0;
 586  616                  pgr->pgr_flags          = 0;
 587  617          }
 588  618          rw_exit(&pgr->pgr_lock);
 589  619  }
 590  620  
 591  621  static void
↓ open down ↓ 213 lines elided ↑ open up ↑
 805  835                  rw_exit(&pgr->pgr_lock);
 806  836                  return;
 807  837          }
 808  838          rw_exit(&pgr->pgr_lock);
 809  839  }
 810  840  
 811  841  /*
 812  842   * Check for any PGR Reservation conflict. return 0 if access allowed
 813  843   */
 814  844  int
 815      -sbd_pgr_reservation_conflict(scsi_task_t *task)
      845 +sbd_pgr_reservation_conflict(scsi_task_t *task, sbd_lu_t *slu)
 816  846  {
 817      -        sbd_lu_t        *slu = (sbd_lu_t *)task->task_lu->lu_provider_private;
 818  847          sbd_pgr_t       *pgr = slu->sl_pgr;
 819  848          sbd_it_data_t   *it  = (sbd_it_data_t *)task->task_lu_itl_handle;
 820  849  
 821  850          /* If Registered */
 822  851          if (pgr->pgr_flags & SBD_PGR_RSVD_ALL_REGISTRANTS && it->pgr_key_ptr)
 823  852                          return (0);
 824  853  
 825  854          /* If you are registered */
 826  855          if (pgr->pgr_flags & SBD_PGR_RSVD_ONE) {
 827  856                  rw_enter(&pgr->pgr_lock, RW_READER);
↓ open down ↓ 551 lines elided ↑ open up ↑
1379 1408                  kmem_free(rpt_ary, sizeof (stmf_remote_port_t) * max_tpdnum);
1380 1409          }
1381 1410  
1382 1411          rport.rport_tptid = ses->ss_rport->rport_tptid;
1383 1412          rport.rport_tptid_sz = ses->ss_rport->rport_tptid_sz;
1384 1413  
1385 1414          (void) sbd_pgr_do_register(slu, it, lpt, &rport, keyflag, svc_key);
1386 1415  
1387 1416  sbd_pgr_reg_done:
1388 1417  
1389      -        if (pgr->pgr_flags & SBD_PGR_APTPL || plist->aptpl) {
     1418 +        if (plist->aptpl || (sbd_pgr_should_save(slu) == B_TRUE)) {
1390 1419                  if (plist->aptpl)
1391 1420                          PGR_SET_FLAG(pgr->pgr_flags, SBD_PGR_APTPL);
1392 1421                  else
1393 1422                          PGR_CLEAR_FLAG(pgr->pgr_flags, SBD_PGR_APTPL);
1394 1423  
1395 1424                  if (sbd_pgr_meta_write(slu) != SBD_SUCCESS) {
1396 1425                          stmf_scsilib_send_status(task, STATUS_CHECK,
1397 1426                              STMF_SAA_INSUFFICIENT_REG_RESOURCES);
1398 1427                          return;
1399 1428                  }
↓ open down ↓ 84 lines elided ↑ open up ↑
1484 1513                          }
1485 1514                  } else {
1486 1515                          stmf_scsilib_send_status(task,
1487 1516                              STATUS_RESERVATION_CONFLICT, 0);
1488 1517                          return;
1489 1518  
1490 1519                  }
1491 1520          /* In case there is no reservation exist */
1492 1521          } else {
1493 1522                  sbd_pgr_do_reserve(pgr, key, it, ses, pr_out);
1494      -                if (pgr->pgr_flags & SBD_PGR_APTPL) {
     1523 +                if (sbd_pgr_should_save(slu) == B_TRUE) {
1495 1524                          if (sbd_pgr_meta_write(slu) != SBD_SUCCESS) {
1496 1525                                  stmf_scsilib_send_status(task, STATUS_CHECK,
1497 1526                                      STMF_SAA_INSUFFICIENT_REG_RESOURCES);
1498 1527                                  return;
1499 1528                          }
1500 1529                  }
1501 1530          }
1502 1531  
1503 1532          stmf_scsilib_send_status(task, STATUS_GOOD, 0);
1504 1533  }
↓ open down ↓ 36 lines elided ↑ open up ↑
1541 1570  sbd_pgr_out_release(scsi_task_t *task)
1542 1571  {
1543 1572          sbd_lu_t        *slu   = (sbd_lu_t *)task->task_lu->lu_provider_private;
1544 1573          scsi_cdb_prout_t        *pr_out = (scsi_cdb_prout_t *)task->task_cdb;
1545 1574          sbd_it_data_t           *it     = task->task_lu_itl_handle;
1546 1575          sbd_pgr_t               *pgr    = slu->sl_pgr;
1547 1576          sbd_pgr_key_t           *key    = it->pgr_key_ptr;
1548 1577  
1549 1578          ASSERT(key);
1550 1579  
     1580 +        /*
     1581 +         * XXX this does not honor APTPL
     1582 +         * (i.e., changes made to a formerly-persistent reservation are not
     1583 +         *  updated here!!!)
     1584 +         */
1551 1585          if (SBD_PGR_RSVD(pgr)) {
1552 1586                  if (pgr->pgr_flags & SBD_PGR_RSVD_ALL_REGISTRANTS ||
1553 1587                      pgr->pgr_rsvholder == key) {
1554 1588                          if (pgr->pgr_rsv_type != pr_out->type ||
1555 1589                              pgr->pgr_rsv_scope != pr_out->scope) {
1556 1590                                  stmf_scsilib_send_status(task, STATUS_CHECK,
1557 1591                                      STMF_SAA_INVALID_RELEASE_OF_PR);
1558 1592                                  return;
1559 1593                          }
1560 1594                          sbd_pgr_do_release(slu, it,
1561 1595                              SBD_UA_RESERVATIONS_RELEASED);
     1596 +
     1597 +                        /*
     1598 +                         * XXX T10 SPC-3 5.6.10.2 says nothing about what to
     1599 +                         * do in the event of a failure updating the
     1600 +                         * PGR nvram store for a reservation associated with
     1601 +                         * an APTPL-enabled (see SPC-3 5.6.4.1) I_T
     1602 +                         * registration during a RELEASE service action.
     1603 +                         *
     1604 +                         * Technically, the CDB completed successfully, as per
     1605 +                         * the spec, but at some point we may need to enter
     1606 +                         * a recovery mode on the initiator(s) if we power cycle
     1607 +                         * the target at the wrong instant...
     1608 +                         */
     1609 +                        if (sbd_pgr_should_save(slu) == B_TRUE) {
     1610 +                                if (sbd_pgr_meta_write(slu) != SBD_SUCCESS) {
     1611 +                                        stmf_scsilib_send_status(task,
     1612 +                                            STATUS_CHECK, /* CSTYLED */
     1613 +                                            STMF_SAA_INSUFFICIENT_REG_RESOURCES);
     1614 +                                        return;
     1615 +                                }
     1616 +                        }
1562 1617                  }
1563 1618          }
1564 1619          stmf_scsilib_send_status(task, STATUS_GOOD, 0);
1565 1620  }
1566 1621  
1567 1622  static void
1568 1623  sbd_pgr_do_release(sbd_lu_t *slu, sbd_it_data_t *it, uint8_t ua_condition)
1569 1624  {
1570 1625  
1571 1626          sbd_pgr_t *pgr    =  slu->sl_pgr;
↓ open down ↓ 23 lines elided ↑ open up ↑
1595 1650          pgr->pgr_rsvholder = NULL;
1596 1651          pgr->pgr_rsv_type = 0;
1597 1652          mutex_enter(&slu->sl_lock);
1598 1653          /* Remove all pointers from IT to pgr keys */
1599 1654          for (it = slu->sl_it_list; it != NULL; it = it->sbd_it_next) {
1600 1655                  it->pgr_key_ptr = NULL;
1601 1656          }
1602 1657          mutex_exit(&slu->sl_lock);
1603 1658          sbd_pgr_keylist_dealloc(slu);
1604 1659          sbd_pgr_set_ua_conditions(slu, it, SBD_UA_RESERVATIONS_PREEMPTED);
1605      -        if (pgr->pgr_flags & SBD_PGR_APTPL) {
     1660 +        if (sbd_pgr_should_save(slu) == B_TRUE) {
1606 1661                  if (sbd_pgr_meta_write(slu) != SBD_SUCCESS) {
1607 1662                          stmf_scsilib_send_status(task, STATUS_CHECK,
1608 1663                              STMF_SAA_INSUFFICIENT_REG_RESOURCES);
1609 1664                          return;
1610 1665                  }
1611 1666          }
1612 1667          pgr->pgr_PRgeneration++;
1613 1668          stmf_scsilib_send_status(task, STATUS_GOOD, 0);
1614 1669  }
1615 1670  
↓ open down ↓ 94 lines elided ↑ open up ↑
1710 1765                  } else {
1711 1766                          if (sbd_pgr_remove_keys(slu, it, key, svc_key, B_TRUE)
1712 1767                              == 0) {
1713 1768                                  stmf_scsilib_send_status(task,
1714 1769                                      STATUS_RESERVATION_CONFLICT, 0);
1715 1770                                  return;
1716 1771                          }
1717 1772                  }
1718 1773          }
1719 1774  
1720      -        if (pgr->pgr_flags & SBD_PGR_APTPL) {
     1775 +        if (sbd_pgr_should_save(slu) == B_TRUE) {
1721 1776                  if (sbd_pgr_meta_write(slu) != SBD_SUCCESS) {
1722 1777                          stmf_scsilib_send_status(task, STATUS_CHECK,
1723 1778                              STMF_SAA_INSUFFICIENT_REG_RESOURCES);
1724 1779                          return;
1725 1780                  }
1726 1781          }
1727 1782  
1728 1783          pgr->pgr_PRgeneration++;
1729 1784  
1730 1785          if (pr_out->action == PR_OUT_PREEMPT_ABORT) {
↓ open down ↓ 93 lines elided ↑ open up ↑
1824 1879          kmem_free(lpt, sizeof (scsi_devid_desc_t) + lpt->ident_length);
1825 1880  
1826 1881          /* Now reserve the key corresponding to the specified IT nexus */
1827 1882          pgr->pgr_rsvholder = newkey;
1828 1883  
1829 1884          if (plist->unreg) {
1830 1885                  sbd_pgr_do_unregister(slu, it, key);
1831 1886          }
1832 1887  
1833 1888  
1834      -        /* Write to disk if currenty aptpl is set or given task is setting it */
1835      -        if (pgr->pgr_flags & SBD_PGR_APTPL || plist->aptpl) {
     1889 +        /* Write to disk if aptpl is currently set or this task is setting it */
     1890 +        if (plist->aptpl || (sbd_pgr_should_save(slu) == B_TRUE)) {
1836 1891                  if (plist->aptpl)
1837 1892                          PGR_SET_FLAG(pgr->pgr_flags, SBD_PGR_APTPL);
1838 1893                  else
1839 1894                          PGR_CLEAR_FLAG(pgr->pgr_flags, SBD_PGR_APTPL);
1840 1895  
1841 1896                  if (sbd_pgr_meta_write(slu) != SBD_SUCCESS) {
1842 1897                          stmf_scsilib_send_status(task, STATUS_CHECK,
1843 1898                              STMF_SAA_INSUFFICIENT_REG_RESOURCES);
1844 1899                          return;
1845 1900                  }
↓ open down ↓ 44 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX