1906 (void) wait_for_acks(dip, dev, spec_type, evtype);
1907 } else if (DEVI(dip)->devi_ct_neg) {
1908 /* one or more contracts going through negotations */
1909 CT_DEBUG((CE_NOTE, "publish: sync contract: waiting"));
1910 result = wait_for_acks(dip, dev, spec_type, evtype);
1911 } else {
1912 /* no negotiated contracts or no broken contracts or NEGEND */
1913 CT_DEBUG((CE_NOTE, "publish: async/no-break/negend"));
1914 result = CT_ACK;
1915 }
1916
1917 /*
1918 * Release the lock only now so that the only point where we
1919 * drop the lock is in wait_for_acks(). This is so that we don't
1920 * miss cv_signal/cv_broadcast from contract holders
1921 */
1922 CT_DEBUG((CE_NOTE, "publish: dropping devi_ct_lock"));
1923 mutex_exit(&(DEVI(dip)->devi_ct_lock));
1924
1925 out:
1926 if (tnvl)
1927 nvlist_free(tnvl);
1928 if (path)
1929 kmem_free(path, MAXPATHLEN);
1930
1931
1932 CT_DEBUG((CE_NOTE, "publish: result = %s", result_str(result)));
1933 return (result);
1934 }
1935
1936
1937 /*
1938 * contract_device_offline
1939 *
1940 * Event publishing routine called by I/O framework when a device is offlined.
1941 */
1942 ct_ack_t
1943 contract_device_offline(dev_info_t *dip, dev_t dev, int spec_type)
1944 {
1945 nvlist_t *nvl;
1946 uint_t result;
|
1906 (void) wait_for_acks(dip, dev, spec_type, evtype);
1907 } else if (DEVI(dip)->devi_ct_neg) {
1908 /* one or more contracts going through negotations */
1909 CT_DEBUG((CE_NOTE, "publish: sync contract: waiting"));
1910 result = wait_for_acks(dip, dev, spec_type, evtype);
1911 } else {
1912 /* no negotiated contracts or no broken contracts or NEGEND */
1913 CT_DEBUG((CE_NOTE, "publish: async/no-break/negend"));
1914 result = CT_ACK;
1915 }
1916
1917 /*
1918 * Release the lock only now so that the only point where we
1919 * drop the lock is in wait_for_acks(). This is so that we don't
1920 * miss cv_signal/cv_broadcast from contract holders
1921 */
1922 CT_DEBUG((CE_NOTE, "publish: dropping devi_ct_lock"));
1923 mutex_exit(&(DEVI(dip)->devi_ct_lock));
1924
1925 out:
1926 nvlist_free(tnvl);
1927 if (path)
1928 kmem_free(path, MAXPATHLEN);
1929
1930
1931 CT_DEBUG((CE_NOTE, "publish: result = %s", result_str(result)));
1932 return (result);
1933 }
1934
1935
1936 /*
1937 * contract_device_offline
1938 *
1939 * Event publishing routine called by I/O framework when a device is offlined.
1940 */
1941 ct_ack_t
1942 contract_device_offline(dev_info_t *dip, dev_t dev, int spec_type)
1943 {
1944 nvlist_t *nvl;
1945 uint_t result;
|