fence Subroutine
Purpose
Allows you to request and change the virtual shared disk fence map.
Syntax
#include <vsd_ioctl.h>
int ioctl(FileDescriptor, Command, Argument)
int FileDescriptor, Command;
void *Argument;
Description
Use this
subroutine to request and change the virtual shared disk fence map.
The fence map, which controls whether virtual shared disks can send
or satisfy requests from virtual shared disks at remote nodes, is
defined as:
struct vsd_FenceMap /* This is the argument to the VSD fence ioctl. */
{
ulong flags;
vsd_minorBitmap_t minornoBitmap; /* Bitmap of minor numbers to fence
(supports 10000 vsds) */
vsd_Fence_Bitmap_t nodesBitmap; /* Nodes to (un)fence these vsds from
(supports node numbers 1-2048) */
}vsd_FenceMap_t
The flags VSD_FENCE and VSD_UNFENCE are mutually exclusive — an ioctl can either fence a set of virtual shared disks or unfence a set of virtual shared disks, but not both. The minornoBitmap denotes which virtual shared disks are to be fenced/unfenced from the nodes specified in the nodesBitmap.
Parameters
- FileDescriptor
- Specifies the open file descriptor for which the control operation is to be performed.
- Command
- Specifies the control function to be performed. The value of this parameter is always GIOCFENCE.
- Argument
- Specifies a pointer to a vsd_fence_map structure.
The flags field of
the vsd_fence_map structure determines the
type of operation that is performed. The flags could be set with
one or more options using the OR operator. These options are as follows:
- VSD_FENCE_FORCE
- If this option is specified, a node can unfence itself.
- VSD_FENCE_GET
- Denotes a query request.
- VSD_FENCE
- Denotes a fence request.
- VSD_UNFENCE
- Denotes an unfence request.
Examples
The following example fences a virtual shared disk with a minor number of 7 from node 4 and 5, and unfences a virtual shared disk with a minor number of 5 from node 1:
int fd;
vsd_FenceMap_t FenceMap;
/* Clear the FenceMap */
bzero(FenceMap, sizeof(vsd_FenceMap_t));
/* fence nodes 4,5 from minor 7 */
FenceMap.flags = VSD_FENCE;
MAP_SET(7, FenceMap.minornoBitmap);
MAP_SET(4, FenceMap.nodesBitmap);
MAP_SET(5, FenceMap.nodesBitmap);
/* Issue the fence request */
ioctl(fd,GIOCFENCE,&FenceMap);
/* Unfence node 1 from minor 5*/
bzero(FenceMap, sizeof(vsd_FenceMap_t));
FenceMap.flags = VSD_UNFENCE | VSD_FENCE_FORCE;
MAP_SET(5, FenceMap.minornoBitmap);
MAP_SET(1, FenceMap.nodesBitmap);
/* Issue the fence request */
ioctl(fd,GIOCFENCE,&FenceMap);
Return Values
If the request succeeds, the ioctl returns 0. In the case of an error, a value of -1 is returned with the global variable errno set to identify the error.
Error Values
The fence ioctl
subroutine can return the following error codes:
- EACCES
- Indicates that an unfence was requested from a fenced node without the VSD_FENCE_FORCE option.
- EINVAL
- Indicates an invalid request (ambiguous flags or unidentified virtual shared disks).
- ENOCONNECT
- Indicates that either the primary or the secondary node for a virtual shared disk to be fenced is not a member of the virtual shared disk group, or the virtual shared disk in question is in the stopped state.
- ENOTREADY
- Indicates that the group is not active or the Recoverable virtual shared disk subsystem is not available.
- ENXIO
- Indicates that the Virtual shared disk driver is being unloaded.