JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
man pages section 7: Device and Network Interfaces     Oracle Solaris 10 1/13 Information Library
search filter icon
search icon

Document Information

Preface

Introduction

Device and Network Interfaces

6to4(7M)

6to4tun(7M)

aac(7D)

adp(7D)

adpu320(7D)

afb(7d)

agpgart_io(7I)

AH(7P)

ahci(7D)

allkmem(7D)

amd8111s(7D)

amr(7D)

ARP(7P)

arp(7P)

ast(7D)

asy(7D)

ata(7D)

atun(7M)

audio1575(7D)

audio(7I)

audio810(7D)

audiocs(7D)

audioens(7D)

audiohd(7D)

audioixp(7D)

audio_support(7I)

audiots(7D)

audiovia823x(7D)

av1394(7D)

bbc_beep(7D)

bcm_sata(7D)

bd(7M)

bge(7D)

bmc(7D)

bnx(7D)

bnxe(7D)

bpp(7D)

bscbus(7D)

bscv(7D)

bufmod(7M)

cadp160(7D)

cadp(7D)

cdio(7I)

ce(7D)

cgsix(7D)

chxge(7D)

cmdk(7D)

connld(7M)

console(7D)

cpqary3(7D)

cpr(7)

cpuid(7D)

ctfs(7FS)

ctsmc(7D)

cvc(7D)

cvcredir(7D)

dad(7D)

daplt(7D)

dbri(7D)

dca(7D)

dcam1394(7D)

dcfs(7FS)

devfs(7FS)

devinfo(7D)

dkio(7I)

dlcosmk(7ipp)

dlpi(7P)

dm2s(7D)

dmfe(7D)

dnet(7D)

dr(7d)

drmach(7d)

dscpmk(7ipp)

dtrace(7D)

e1000(7D)

e1000g(7D)

ecpp(7D)

efb(7D)

ehci(7D)

elxl(7D)

emlxs(7D)

eri(7D)

esp(7D)

ESP(7P)

fas(7D)

fasttrap(7D)

fbio(7I)

fbt(7D)

fcip(7D)

fcp(7D)

fctl(7D)

fd(7D)

fdc(7D)

fdio(7I)

ffb(7D)

firewire(7D)

flowacct(7ipp)

fp(7d)

FSS(7)

ge(7D)

gld(7D)

glm(7D)

gpio_87317(7D)

grbeep(7d)

hci1394(7D)

hdio(7I)

hermon(7D)

hid(7D)

hme(7D)

hpfc(7D)

hsfs(7FS)

hubd(7D)

hxge(7D)

i2bsc(7D)

i2o_bs(7D)

i2o_scsi(7D)

ib(7D)

ibcm(7D)

ibd(7D)

ibdm(7D)

ibmf(7)

ibtl(7D)

icmp6(7P)

ICMP(7P)

icmp(7P)

idn(7d)

ieee1394(7D)

if(7P)

ifb(7d)

ifp(7D)

if_tcp(7P)

igb(7D)

igbvf(7D)

imraid_sas(7D)

inet6(7P)

inet(7P)

ip6(7P)

IP(7P)

ip(7P)

ipge(7D)

ipgpc(7ipp)

ipmi(7D)

ipnat(7I)

ipqos(7ipp)

iprb(7D)

ipsec(7P)

ipsecah(7P)

ipsecesp(7P)

iscsi(7D)

isdnio(7I)

iser(7D)

isp(7D)

ixgb(7d)

ixgbe(7D)

ixgbevf(7D)

jfb(7D)

jfca(7D)

kb(7M)

kdmouse(7D)

kfb(7D)

kmdb(7d)

kmem(7D)

kstat(7D)

ksyms(7D)

ldterm(7M)

llc1(7D)

llc2(7D)

lockstat(7D)

lofi(7D)

lofs(7FS)

log(7D)

logi(7D)

lsimega(7D)

lx_systrace(7D)

m64(7D)

marvell88sx(7D)

mc-opl(7D)

mcxe(7D)

md(7D)

mediator(7D)

mega_sas(7D)

mem(7D)

mga(7D)

mhd(7i)

mixer(7I)

mpt(7D)

mpt_sas(7D)

mr_sas(7D)

msglog(7D)

msm(7D)

mt(7D)

mtio(7I)

n2cp(7d)

n2rng(7d)

ncp(7D)

ncrs(7D)

nfb(7D)

ngdr(7d)

ngdrmach(7d)

nge(7D)

npe(7D)

ntwdt(7D)

ntxn(7D)

null(7D)

nulldriver(7D)

nv_sata(7D)

nxge(7D)

objfs(7FS)

oce(7D)

ocf_ibutton(7D)

ohci(7D)

openprom(7D)

oplkmdrv(7D)

oplmsu(7D)

oplpanel(7D)

pcata(7D)

pcelx(7D)

pcfs(7FS)

pcic(7D)

pcicmu(7D)

pcie_pci(7D)

pckt(7M)

pcmcia(7D)

pcmem(7D)

pcn(7D)

pcram(7D)

pcscsi(7D)

pcser(7D)

pfb(7D)

pf_key(7P)

pfmod(7M)

physmem(7D)

pipemod(7M)

pm(7D)

poll(7d)

prnio(7I)

profile(7D)

ptem(7M)

ptm(7D)

pts(7D)

pty(7D)

qfe(7d)

qlc(7D)

qlcnic(7D)

qlge(7D)

quotactl(7I)

qus(7D)

ramdisk(7D)

random(7D)

RARP(7P)

rarp(7P)

rge(7D)

route(7P)

routing(7P)

rtls(7D)

sad(7D)

sata(7D)

sbpro(7D)

scfd(7D)

scmi2c(7d)

scsa1394(7D)

scsa2usb(7D)

scsi_vhci(7D)

SCTP(7P)

sctp(7P)

scu(7D)

sd(7D)

SDC(7)

sdp(7D)

sdt(7D)

se(7D)

se_hdlc(7D)

ses(7D)

sesio(7I)

sf(7D)

sgen(7D)

sharefs(7FS)

si3124(7D)

sip(7P)

sk98sol(7D)

skfp(7D)

slp(7P)

smbios(7D)

smbus(7D)

socal(7D)

sockio(7I)

sol_ofs(7D)

sol_ucma(7D)

sol_uverbs(7D)

sppptun(7M)

spwr(7D)

ssd(7D)

st(7D)

stp4020(7D)

streamio(7I)

su(7D)

sxge(7D)

sxp(7D)

symhisl(7D)

sysmsg(7D)

systrace(7D)

tavor(7D)

TCP(7P)

tcp(7P)

termio(7I)

termiox(7I)

ticlts(7D)

ticots(7D)

ticotsord(7D)

timod(7M)

tirdwr(7M)

tmpfs(7FS)

todopl(7D)

tokenmt(7ipp)

tpf(7D)

tsalarm(7D)

tswtclmt(7ipp)

ttcompat(7M)

tty(7D)

ttymux(7D)

tun(7M)

tzmon(7d)

uata(7D)

udfs(7FS)

UDP(7P)

udp(7P)

ufs(7FS)

ugen(7D)

uhci(7D)

urandom(7D)

usb(7D)

usba(7D)

usb_ac(7D)

usb_ah(7M)

usb_as(7D)

usbecm(7D)

usbkbm(7M)

usb_mid(7D)

usbms(7M)

usbprn(7D)

usbsacm(7D)

usbser_edge(7D)

usbsksp(7D)

usbsprl(7D)

uscsi(7I)

usoc(7D)

virtualkm(7D)

visual_io(7I)

vni(7d)

volfs(7FS)

vuid2ps2(7M)

vuid3ps2(7M)

vuidm3p(7M)

vuidm4p(7M)

vuidm5p(7M)

vuidmice(7M)

wrsm(7D)

wrsmd(7D)

wscons(7D)

xge(7D)

xhci(7D)

xmemfs(7FS)

zcons(7D)

zero(7D)

zs(7D)

zsh(7D)

zulu(7d)

mhd

- multihost disk control operations

Synopsis

#include <sys/mhd.h> 

Description

The mhd ioctl(2) control access rights of a multihost disk, using disk reservations on the disk device.

The stability level of this interface (see attributes(5)) is evolving. As a result, the interface is subject to change and you should limit your use of it.

The mhd ioctls fall into two major categories: (1) ioctls for non-shared multihost disks and (2) ioctls for shared multihost disks.

One ioctl, MHIOCENFAILFAST, is applicable to both non-shared and shared multihost disks. It is described after the first two categories.

All the ioctls require root privilege.

For all of the ioctls, the caller should obtain the file descriptor for the device by calling open(2) with the O_NDELAY flag; without the O_NDELAY flag, the open may fail due to another host already having a conflicting reservation on the device. Some of the ioctls below permit the caller to forcibly clear a conflicting reservation held by another host, however, in order to call the ioctl, the caller must first obtain the open file descriptor.

Non-shared multihost disks

Non-shared multihost disks ioctls consist of MHIOCTKOWN, MHIOCRELEASE, HIOCSTATUS, and MHIOCQRESERVE. These ioctl requests control the access rights of non-shared multihost disks. A non-shared multihost disk is one that supports serialized, mutually exclusive I/O mastery by the connected hosts. This is in contrast to the shared-disk model, in which concurrent access is allowed from more than one host (see below).

A non-shared multihost disk can be in one of two states:

Each multihost disk driver views the machine on which it's running as the "local host"; each views all other machines as "remote hosts". For each I/O or ioctl request, the requesting host is the local host.

Note that the non-shared ioctls are designed to work with SCSI-2 disks. The SCSI-2 RESERVE/RELEASE command set is the underlying hardware facility in the device that supports the non-shared ioctls.

The function prototypes for the non-shared ioctls are:

ioctl(fd, MHIOCTKOWN);
ioctl(fd, MHIOCRELEASE);
ioctl(fd, MHIOCSTATUS);
ioctl(fd, MHIOCQRESERVE);
MHIOCTKOWN

Forcefully acquires exclusive access rights to the multihost disk for the local host. Revokes all access rights to the multihost disk from remote hosts. Causes the disk to enter the exclusive access state.

Implementation Note: Reservations (exclusive access rights) broken via random resets should be reinstated by the driver upon their detection, for example, in the automatic probe function described below.

MHIOCRELEASE

Relinquishes exclusive access rights to the multihost disk for the local host. On success, causes the disk to enter the non- exclusive access state.

MHIOCSTATUS

Probes a multihost disk to determine whether the local host has access rights to the disk. Returns 0 if the local host has access to the disk, 1 if it doesn't, and -1 with errno set to EIO if the probe failed for some other reason.

MHIOCQRESERVE

Issues, simply and only, a SCSI-2 Reserve command. If the attempt to reserve fails due to the SCSI error Reservation Conflict (which implies that some other host has the device reserved), then the ioctl will return –1 with errno set to EACCES. The MHIOCQRESERVE ioctl does NOT issue a bus device reset or bus reset prior to attempting the SCSI-2 reserve command. It also does not take care of re-instating reservations that disappear due to bus resets or bus device resets; if that behavior is desired, then the caller can call MHIOCTKOWN after the MHIOCQRESERVE has returned success. If the device does not support the SCSI-2 Reserve command, then the ioctl returns –1 with errno set to ENOTSUP. The MHIOCQRESERVE ioctl is intended to be used by high-availability or clustering software for a "quorum" disk, hence, the "Q" in the name of the ioctl.

Shared Multihost Disks

Shared multihost disks ioctls control access to shared multihost disks. The ioctls are merely a veneer on the SCSI-3 Persistent Reservation facility. Therefore, the underlying semantic model is not described in detail here, see instead the SCSI-3 standard. The SCSI-3 Persistent Reservations support the concept of a group of hosts all sharing access to a disk.

The function prototypes and descriptions for the shared multihost ioctls are as follows:

ioctl(fd, MHIOCGRP_INKEYS, (mhioc_inkeys_t) *k);

Issues the SCSI-3 command Persistent Reserve In Read Keys to the device. On input, the field k->li should be initialized by the caller with k->li.listsize reflecting how big of an array the caller has allocated for the k->li.list field and with k->li.listlen == 0. On return, the field k->li.listlen is updated to indicate the number of reservation keys the device currently has: if this value is larger than k->li.listsize then that indicates that the caller should have passed a bigger k->li.list array with a bigger k->li.listsize. The number of array elements actually written by the callee into k->li.list is the minimum of k->li.listlen and k->li.listsize. The field k->generation is updated with the generation information returned by the SCSI-3 Read Keys query. If the device does not support SCSI-3 Persistent Reservations, then this ioctl returns –1 with errno set to ENOTSUP.

ioctl(fd, MHIOCGRP_INRESVS, (mhioc_inresvs_t) *r);

Issues the SCSI-3 command Persistent Reserve In Read Reservations to the device. Remarks similar to MHIOCGRP_INKEYS apply to the array manipulation. If the device does not support SCSI-3 Persistent Reservations, then this ioctl returns –1 with errno set to ENOTSUP.

ioctl(fd, MHIOCGRP_REGISTER, (mhioc_register_t) *r);

Issues the SCSI-3 command Persistent Reserve Out Register. The fields of structure r are all inputs; none of the fields are modified by the ioctl. The field r->aptpl should be set to true to specify that registrations and reservations should persist across device power failures, or to false to specify that registrations and reservations should be cleared upon device power failure; true is the recommended setting. The field r->oldkey is the key that the caller believes the device may already have for this host initiator; if the caller believes that that this host initiator is not already registered with this device, it should pass the special key of all zeros. To achieve the effect of unregistering with the device, the caller should pass its current key for the r->oldkey field and an r->newkey field containing the special key of all zeros. If the device returns the SCSI error code Reservation Conflict, this ioctl returns –1 with errno set to EACCES.

ioctl(fd, MHIOCGRP_RESERVE, (mhioc_resv_desc_t) *r);

Issues the SCSI-3 command Persistent Reserve Out Reserve. The fields of structure r are all inputs; none of the fields are modified by the ioctl. If the device returns the SCSI error code Reservation Conflict, this ioctl returns –1 with errno set to EACCES.

ioctl(fd, MHIOCGRP_PREEMPTANDABORT, (mhioc_preemptandabort_t) *r);

Issues the SCSI-3 command Persistent Reserve Out Preempt-And-Abort. The fields of structure r are all inputs; none of the fields are modified by the ioctl. The key of the victim host is specified by the field r->victim_key. The field r->resvdesc supplies the preempter's key and the reservation that it is requesting as part of the SCSI-3 Preempt-And-Abort command. If the device returns the SCSI error code Reservation Conflict, this ioctl returns –1 with errno set to EACCES.

ioctl(fd, MHIOCGRP_PREEMPT, (mhioc_preemptandabort_t) *r);

Similar to MHIOCGRP_PREEMPTANDABORT, but instead issues the SCSI-3 command Persistent Reserve Out Preempt.

ioctl(fd, MHIOCGRP_CLEAR, (mhioc_resv_key_t) *r);

Issues the SCSI-3 command Persistent Reserve Out Clear. The input parameter r is the reservation key of the caller, which should have been already registered with the device, by an earlier call to MHIOCGRP_REGISTER.

For each device, the non-shared ioctls should not be mixed with the Persistent Reserve Out shared ioctls, and vice-versa, otherwise, the underlying device is likely to return errors, because SCSI does not permit SCSI-2 reservations to be mixed with SCSI-3 reservations on a single device. It is, however, legitimate to call the Persistent Reserve In ioctls, because these are query only. Issuing the MHIOCGRP_INKEYS ioctl is the recommended way for a caller to determine if the device supports SCSI-3 Persistent Reservations (the ioctl will return –1 with errno set to ENOTSUP if the device does not).

MHIOCENFAILFAST Ioctl

The MHIOCENFAILFAST ioctl is applicable for both non-shared and shared disks, and may be used with either the non-shared or shared ioctls.

ioctl(fd, MHIOENFAILFAST, (unsigned int *) millisecs);

Enables or disables the failfast option in the multihost disk driver and enables or disables automatic probing of a multihost disk, described below. The argument is an unsigned integer specifying the number of milliseconds to wait between executions of the automatic probe function. An argument of zero disables the failfast option and disables automatic probing. If the MHIOCENFAILFAST ioctl is never called, the effect is defined to be that both the failfast option and automatic probing are disabled.

Automatic Probing

The MHIOCENFAILFAST ioctl sets up a timeout in the driver to periodically schedule automatic probes of the disk. The automatic probe function works in this manner: The driver is scheduled to probe the multihost disk every n milliseconds, rounded up to the next integral multiple of the system clock's resolution. If

  1. the local host no longer has access rights to the multihost disk, and

  2. access rights were expected to be held by the local host,

the driver immediately panics the machine to comply with the failfast model.

If the driver makes this discovery outside the timeout function, especially during a read or write operation, it is imperative that it panic the system then as well.

Return Values

Each request returns –1 on failure and sets errno to indicate the error.

EPERM

Caller is not root.

EACCES

Access rights were denied.

EIO

The multihost disk or controller was unable to successfully complete the requested operation.

EOPNOTSUP

The multihost disk does not support the operation. For example, it does not support the SCSI-2 Reserve/Release command set, or the SCSI-3 Persistent Reservation command set.

Attributes

See attributes(5) for a description of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Availability
SUNWhea
Stability
Evolving

See Also

ioctl(2), open(2), attributes(5), open(2)