Server Interface
\author Edward R. Zayas
Transarc Corporation
- Version
- 1.0
- Date
- 29 August 1991 14:48 Copyright 1991 Transarc Corporation All Rights Reserved FS-00-D165
\page chap1 Chapter 1: Overview
\section sec1-1 Section 1.1: Introduction
- This document describes the architecture and interfaces for two of the important agents of the AFS distributed file system, the Volume Server and the Volume Location Server. The Volume Server allows operations affecting entire AFS volumes to be executed, while the Volume Location Server provides a lookup service for volumes, identifying the server or set of servers on which volume instances reside.
\section sec1-2 Section 1.2: Volumes
\subsection sec1-2-1 Section 1.2.1: Definition
- The underlying concept manipulated by the two AFS servers examined by this document is the volume. Volumes are the basic mechanism for organizing the data stored within the file system. They provide the foundation for addressing, storing, and accessing file data, along with serving as the administrative units for replication, backup, quotas, and data motion between File Servers.
- Specifically, a volume is a container for a hierarchy of files, a connected file system subtree. In this respect, a volume is much like a traditional unix file system partition. Like a partition, a volume can be mounted in the sense that the root directory of the volume can be named within another volume at an AFS mount point. The entire file system hierarchy is built up in this manner, using mount points to glue together the individual subtrees resident within each volume. The root of this hierarchy is then mounted by each AFS client machine using a conventional unix mount point within the workstation's local file system. By convention, this entryway into the AFS domain is mounted on the /afs local directory. From a user's point of view, there is only a single mount point to the system; the internal mount points are generally transparent.
\subsection sec1-2-2 Section 1.2.2: Volume Naming
- There are two methods by which volumes may be named. The first is via a human-readable string name, and the second is via a 32-bit numerical identifier. Volume identifiers, whether string or numerical, must be unique within any given cell. AFS mount points may use either representation to specify the volume whose root directory is to be accessed at the given position. Internally, however, AFS agents use the numerical form of identification exclusively, having to translate names to the corresponding 32-bit value.
\subsection sec1-2-3 Section 1.2.3: Volume Types
- There are three basic volume types: read-write, read-only, and backup volumes.
- This paper is a member of a documentation suite providing specifications of the operation and interfaces offered by the various AFS servers and agents. The scope of this work is to provide readers with a sufficiently detailed description of the Volume Location Server and the Volume Server so that they may construct client applications which call their RPC interface routines.
\section sec1-4 Section 1.4: Document Layout
- After this introductory portion of the document, Chapters 2 and 3 examine the architecture and RPC interface of the Volume Location Server and its replicated database. Similarly, Chapters 4 and 5 describe the architecture and RPC interface of the Volume Server.
\page chap2 Chapter 2: Volume Location Server Architecture
\section sec2-1 Section 2.1: Introduction
- The Volume Location Server allows AFS agents to query the location and basic status of volumes resident within the given cell. Volume Location Server functions may be invoked directly from authorized users via the vos utility.
- This chapter briefly discusses various aspects of the Volume Location Server's architecture. First, the need for volume location is examined, and the specific parties that call the Volume Location Server interface routines are identified. Then, the database maintained to provide volume location service, the Volume Location Database (VLDB), is examined. Finally, the vlserver process which implements the Volume Location Server is considered.
- As with all AFS servers, the Volume Location Server uses the Rx remote procedure call package for communication with its clients.
\section sec2-2 Section 2.2: The Need For Volume Location
- The Cache Manager agent is the primary consumer of AFS volume location service, on which it is critically dependent for its own operation. The Cache Manager needs to map volume names or numerical identifiers to the set of File Servers on which its instances reside in order to satisfy the file system requests it is processing on behalf of it clients. Each time a Cache Manager encounters a mount point for which it does not have location information cached, it must acquire this information before the pathname resolution may be successfully completed. Once the File Server set is known for a particular volume, the Cache Manager may then select the proper site among them (e.g. choosing the single home for a read-write volume, or randomly selecting a site from a read-only volume's replication set) and begin addressing its file manipulation operations to that specific server.
- While the Cache Manager consults the volume location service, it is not capable of changing the location of volumes and hence modifying the information contained therein. This capability to perform acts which change volume location is concentrated within the Volume Server. The Volume Server process running on each server machine manages all volume operations affecting that platform, including creations, deletions, and movements between servers. It must update the volume location database every time it performs one of these actions.
- None of the other AFS system agents has a need to access the volume location database for its site. Surprisingly, this also applies to the File Server process. It is only aware of the specific set of volumes that reside on the set of physical disks directly attached to the machine on which they execute. It has no knowlege of the universe of volumes resident on other servers, either within its own cell or in foreign cells.
\section sec2-3 Section 2.3: The VLDB
- The Volume Location Database (VLDB) is used to allow AFS application programs to discover the location of any volume within its cell, along with select information about the nature and state of that volume. It is organized in a very straightforward fashion, and uses the ubik [4] [5] facility to to provide replication across multiple server sites.
\subsection sec2-3-1 Section 2.3.1: Layout
- The VLDB itself is a very simple structure, and synchronized copies may be maintained at two or more sites. Basically, each copy consists of header information, followed by a linear (yet unbounded) array of entries. There are several associated hash tables used to perform lookups into the VLDB. The first hash table looks up volume location information based on the volume's name. There are three other hash tables used for lookup, based on volume ID/type pairs, one for each possible volume type.
- The VLDB for a large site may grow to contain tens of thousands of entries, so some attempts were made to make each entry as small as possible. For example, server addresses within VLDB entries are represented as single-byte indicies into a table containing the full longword IP addresses.
- A free list is kept for deleted VLDB entries. The VLDB will not grow unless all the entries on the free list have been exhausted, keeping it as compact as possible.
\subsection sec2-3-2 Section 2.3.2: Database Replication
- The VLDB, along with other important AFS databases, may be replicated to multiple sites to improve its availability. The ubik replication package is used to implement this functionality for the VLDB. A full description of ubik and of the quorum completion algorithm it implements may be found in [4] and [5]. The basic abstraction provided by ubik is that of a disk file replicated to multiple server locations. One machine is considered to be the synchronization site, handling all write operations on the database file. Read operations may be directed to any of the active members of the quorum, namely a subset of the replication sites large enough to insure integrity across such failures as individual server crashes and network partitions. All of the quorum members participate in regular elections to determine the current synchronization site. The ubik algorithms allow server machines to enter and exit the quorum in an orderly and consistent fashion. All operations to one of these replicated "abstract files" are performed as part of a transaction. If all the related operations performed under a transaction are successful, then the transaction is committed, and the changes are made permanent. Otherwise, the transaction is aborted, and all of the operations for that transaction are undone.
\section sec2-4 Section 2.4: The vlserver Process
- The user-space vlserver process is in charge of providing volume location service for AFS clients. This program maintains the VLDB replica at its particular server, and cooperates with all other vlserver processes running in the given cell to propagate updates to the database. It implements the RPC interface defined in the vldbint.xg definition file for the rxgen RPC stub generator program. As part of its startup sequence, it must discover the VLDB version it has on its local disk, move to join the quorum of replication sites for the VLDB, and get the latest version if the one it came up with was out of date. Eventually, it will synchronize with the other VLDB replication sites, and it will begin accepting calls.
- The vlserver program uses at most three Rx worker threads to listen for incoming Volume Location Server calls. It has a single, optional command line argument. If the string "-noauth" appears when the program is invoked, then vlserver will run in an unauthenticated mode where any individual is considered authorized to perform any VLDB operation. This mode is necessary when first bootstrapping an AFS installation.
\page chap3 Chapter 3: Volume Location Server Interface
\section sec3-1 Section 3.1: Introduction
- This chapter documents the API for the Volume Location Server facility, as defined by the vldbint.xg Rxgen interface file and the vldbint.h include file. Descriptions of all the constants, structures, macros, and interface functions available to the application programmer appear here.
- It is expected that Volume Location Server client programs run in user space, as does the associated vos volume utility. However, the kernel-resident Cache Manager agent also needs to call a subset of the Volume Location Server's RPC interface routines. Thus, a second Volume Location Server interface is available, built exclusively to satisfy the Cache Manager's limited needs. This subset interface is defined by the afsvlint.xg Rxgen interface file, and is examined in the final section of this chapter.
\section sec3-2 3.2: Constants
- This section covers the basic constant definitions of interest to the Volume Location Server application programmer. These definitions appear in the vldbint.h file, automatically generated from the vldbint.xg Rxgen interface file, and in vlserver.h.
- Each subsection is devoted to describing the constants falling into the following categories:
- These constants define some basic system values, including configuration information.
- Name
- MAXNAMELEN
- Value
- 65
- Description
- Maximum size of various character strings, including volume name fields in structures and host names.
- Name
- MAXNSERVERS
- Value
- 8
- Description
- Maximum number of replications sites for a volume.
- Name
- MAXTYPES
- Value
- 3
- Description
- Maximum number of volume types.
- Name
- VLDBVERSION
- Value
- 1
- Description
- VLDB database version number
- Name
- HASHSIZE
- Value
- 8,191
- Description
- Size of internal Volume Location Server volume name and volume ID hash tables. This must always be a prime number.
- Name
- NULLO
- Value
- 0
- Description
- Specifies a null pointer value.
- Name
- VLDBALLOCCOUNT
- Value
- 40
- Description
- Value used when allocating memory internally for VLDB entry records.
- Name
- BADSERVERID
- Value
- 255
- Description
- Illegal Volume Location Server host ID.
- Name
- MAXSERVERID
- Value
- 30
- Description
- Maximum number of servers appearing in the VLDB.
- Name
- MAXSERVERFLAG
- Value
- 0x80
- Description
- First unused flag value in such fields as serverFlags in struct vldbentry and RepsitesNewFlags in struct VldbUpdateEntry.
- Name
- MAXPARTITIONID
- Value
- 126
- Description
- Maximum number of AFS disk partitions for any one server.
- Name
- MAXBUMPCOUNT
- Value
- 0x7fffffff
- Description
- Maximum interval that the current high-watermark value for a volume ID can be increased in one operation.
- Name
- MAXLOCKTIME
- Value
- 0x7fffffff
- Description
- Maximum number of seconds that any VLDB entry can remain locked.
- Name
- SIZE
- Value
- 1,024
- Description
- Maximum size of the name field within a struct.
\subsection sec3-2-2 Section 3.2.2: Update Entry Bits
- These constants define bit values for the Mask field in the struct VldbUpdateEntry. Specifically, setting these bits is equivalent to declaring that the corresponding field within an object of type struct VldbUpdateEntry has been set. For example, setting the VLUPDATE VOLUMENAME flag in Mask indicates that the name field contains a valid value.
- Name
- VLUPDATE VOLUMENAME
- Value
- 0x0001
- Description
- If set, indicates that the name field is valid.
- Name
- VLUPDATE VOLUMETYPE
- Value
- 0x0002
- Description
- If set, indicates that the volumeType field is valid.
- Name
- VLUPDATE FLAGS
- Value
- 0x0004
- Description
- If set, indicates that the flags field is valid.
- Name
- VLUPDATE READONLYID
- Value
- 0x0008
- Description
- If set, indicates that the ReadOnlyId field is valid.
- Name
- VLUPDATE BACKUPID
- Value
- 0x0010
- Description
- If set, indicates that the BackupId field is valid.
- Name
- VLUPDATE REPSITES
- Value
- 0x0020
- Description
- If set, indicates that the nModifiedRepsites field is valid.
- Name
- VLUPDATE CLONEID
- Value
- 0x0080
- Description
- If set, indicates that the cloneId field is valid.
- Name
- VLUPDATE REPS DELETE
- Value
- 0x0100
- Description
- Is the replica being deleted?
- Name
- VLUPDATE REPS ADD
- Value
- 0x0200
- Description
- Is the replica being added?
- Name
- VLUPDATE REPS MODSERV
- Value
- 0x0400
- Description
- Is the server part of the replica location correct?
- Name
- VLUPDATE REPS MODPART
- Value
- 0x0800
- Description
- Is the partition part of the replica location correct?
- Name
- VLUPDATE REPS MODFLAG
- Value
- 0x1000
- Description
- Various modification flag values.
\subsection sec3-2-3 Section 3.2.3: List-By-Attribute Bits
- These constants define bit values for the Mask field in the struct VldbListByAttributes is to be used in a match. Specifically, setting these bits is equivalent to declaring that the corresponding field within an object of type struct VldbListByAttributes is set. For example, setting the VLLIST SERVER flag in Mask indicates that the server field contains a valid value.
- Name
- VLLIST SERVER
- Value
- 0x1
- Description
- If set, indicates that the server field is valid.
- Name
- VLLIST PARTITION
- Value
- 0x2
- Description
- If set, indicates that the partition field is valid.
- Name
- VLLIST VOLUMETYPE
- Value
- 0x4
- Description
- If set, indicates that the volumetype field is valid.
- Name
- VLLIST VOLUMEID
- Value
- 0x8
- Description
- If set, indicates that the volumeid field is valid.
- Name
- VLLIST FLAG
- Value
- 0x10
- Description
- If set, indicates that that flag field is valid.
\subsection sec3-2-4 Section 3.2.4: Volume Type Indices
- These constants specify the order of entries in the volumeid array in an object of type struct vldbentry. They also identify the three different types of volumes in AFS.
- Name
- RWVOL
- Value
- 0
- Description
- Read-write volume.
- Name
- ROVOL
- Value
- 1
- Description
- Read-only volume.
- Name
- BACKVOL
- Value
- 2
- Description
- Backup volume.
\subsection sec3-2-5 Section 3.2.5: States for struct vlentry
- The following constants appear in the flags field in objects of type struct vlentry. The first three values listed specify the state of the entry, while all the rest stamp the entry with the type of an ongoing volume operation, such as a move, clone, backup, deletion, and dump. These volume operations are the legal values to provide to the voloper parameter of the VL SetLock() interface routine.
- For convenience, the constant VLOP ALLOPERS is defined as the inclusive OR of the above values from VLOP MOVE through VLOP DUMP.
- Name
- VLFREE
- Value
- 0x1
- Description
- Entry is in the free list.
- Name
- VLDELETED
- Value
- 0x2
- Description
- Entry is soft-deleted.
- Name
- VLLOCKED
- Value
- 0x4
- Description
- Advisory lock held on the entry.
- Name
- VLOP MOVE
- Value
- 0x10
- Description
- The associated volume is being moved between servers.
- Name
- VLOP RELEASE
- Value
- 0x20
- Description
- The associated volume is being cloned to its replication sites.
- Name
- VLOP BACKUP
- Value
- 0x40
- Description
- A backup volume is being created for the associated volume.
- Name
- VLOP DELETE
- Value
- 0x80
- Description
- The associated volume is being deleted.
- Name
- VLOP DUMP
- Value
- 0x100
- Description
- A dump is being taken of the associated volume.
\subsection sec3-2-6 Section 3.2.6: States for struct vldbentry
- Of the following constants, the first three appear in the flags field within an object of type struct vldbentry, advising of the existence of the basic volume types for the given volume, and hence the validity of the entries in the volumeId array field. The rest of the values provided in this table appear in the serverFlags array field, and apply to the instances of the volume appearing in the various replication sites.
- This structure appears in numerous Volume Location Server interface calls, namely VL CreateEntry(), VL GetEntryByID(), VL GetEntryByName(), VL ReplaceEntry() and VL ListEntry().
- Name
- VLF RWEXISTS
- Value
- 0x1000
- Description
- The read-write volume ID is valid.
- Name
- VLF ROEXISTS
- Value
- 0x2000
- Description
- The read-only volume ID is valid.
- Name
- VLF BACKEXISTS
- Value
- 0x4000
- Description
- The backup volume ID is valid.
- Name
- VLSF NEWREPSITE
- Value
- 0x01
- Description
- Not used; originally intended to mark an entry as belonging to a partially-created volume instance.
- Name
- VLSF ROVOL
- Value
- 0x02
- Description
- A read-only version of the volume appears at this server.
- Name
- VLSF RWVOL
- Value
- 0x02
- Description
- A read-write version of the volume appears at this server.
- Name
- VLSF BACKVOL
- Value
- 0x08
- Description
- A backup version of the volume appears at this server.
\subsection sec3-2-7 Section 3.2.7: ReleaseType Argument Values
- The following values are used in the ReleaseType argument to various Volume Location Server interface routines, namely VL ReplaceEntry(), VL UpdateEntry() and VL ReleaseLock().
- Name
- LOCKREL TIMESTAMP
- Value
- 1
- Description
- Is the LockTimestamp field valid?
- Name
- LOCKREL OPCODE
- Value
- 2
- Description
- Are any of the bits valid in the flags field?
- Name
- LOCKREL AFSID
- Value
- 4
- Description
- Is the LockAfsId field valid?
\subsection sec3-2-8 Section 3.2.8: Miscellaneous
- Miscellaneous values.
- Name
- VLREPSITE NEW
- Value
- 1
- Description
- Has a replication site gotten a new release of a volume?
- A synonym for this constant is VLSF NEWREPSITE.
\section sec3-3 Section 3.3: Structures and Typedefs
- This section describes the major exported Volume Location Server data structures of interest to application programmers, along with the typedefs based upon those structures.
\subsection sec3-3-1 Section 3.3.1: struct vldbentry
- This structure represents an entry in the VLDB as made visible to Volume Location Server clients. It appears in numerous Volume Location Server interface calls, namely VL CreateEntry(), VL GetEntryByID(), VL GetEntryByName(), VL ReplaceEntry() and VL ListEntry().
Fields
- This structure is used internally by the Volume Location Server to fully represent a VLDB entry. The client-visible struct vldbentry represents merely a subset of the information contained herein.
Fields
- This structure defines the leading section of the VLDB header, of type struct vlheader. It contains frequently-used global variables and general statistics information.
Fields
- This is the layout of the information stored in the VLDB header. Notice it includes an object of type struct vital vlheader described above (see Section 3.3.3) as the first field.
Fields
- This structure is used as an argument to the VL UpdateEntry() routine (see Section 3.6.7). Please note that multiple entries can be updated at once by setting the appropriate Mask bits. The bit values for this purpose are defined in Section 3.2.2.
Fields
- This structure is used by the VL ListAttributes() routine (see Section 3.6.11).
Fields
- This structure is used to construct the vldblist object (See Section 3.3.12), which basically generates a queueable (singly-linked) version of struct vldbentry.
Fields
- This structure defines the item returned in linked list form from the VL LinkedList() function (see Section 3.6.12). This same object is also returned in bulk form in calls to the VL ListAttributes() routine (see Section 3.6.11).
Fields
- This structure defines fields to record statistics on opcode hit frequency. The MAX NUMBER OPCODES constant has been defined as the maximum number of opcodes supported by this structure, and is set to 30.
Fields
typedef opaque bulk<DEFAULTBULK>;
- This typedef may be used to transfer an uninterpreted set of bytes across the Volume Location Server interface. It may carry up to DEFAULTBULK (10,000) bytes.
Fields
typedef vldbentry bulkentries<>;
- This typedef is used to transfer an unbounded number of struct vldbentry objects. It appears in the parameter list for the VL ListAttributes() interface function.
Fields
typedef struct single_vldbentry *vldblist;
- This typedef defines a queueable struct vldbentry object, referenced by the single vldbentry typedef as well as struct vldb list.
\subsection sec3-3-13 Section 3.3.13: vlheader
typedef struct vlheader vlheader;
- This typedef provides a short name for objects of type struct vlheader (see Section 3.3.4).
\subsection sec3-3-14 Section 3.3.14: vlentry
typedef struct vlentry vlentry;
- This typedef provides a short name for objects of type struct vlentry (see Section 3.3.2).
\section sec3-4 Section 3.4: Error Codes
- This section covers the set of error codes exported by the Volume Location Server, displaying the printable phrases with which they are associated.
- Name
- VL IDEXIST
- Value
- (363520L)
- Description
- Volume Id entry exists in vl database.
- Name
- VL IO
- Value
- (363521L)
- Description
- I/O related error.
- Name
- VL NAMEEXIST
- Value
- (363522L)
- Description
- Volume name entry exists in vl database.
- Name
- VL CREATEFAIL
- Value
- (363523L)
- Description
- Internal creation failure.
- Name
- VL NOENT
- Value
- (363524L)
- Description
- No such entry.
- Name
- VL EMPTY
- Value
- (363525L)
- Description
- Vl database is empty.
- Name
- VL ENTDELETED
- Value
- (363526L)
- Description
- Entry is deleted (soft delete).
- Name
- VL BADNAME
- Value
- (363527L)
- Description
- Volume name is illegal.
- Name
- VL BADINDEX
- Value
- (363528L)
- Description
- Index is out of range.
- Name
- VL BADVOLTYPE
- Value
- (363529L)
- Description
- Bad volume range.
- Name
- VL BADSERVER
- Value
- (363530L)
- Description
- Illegal server number (out of range).
- Name
- VL BADPARTITION
- Value
- (363531L)
- Description
- Bad partition number.
- Name
- VL REPSFULL
- Value
- (363532L)
- Description
- Run out of space for Replication sites.
- Name
- VL NOREPSERVER
- Value
- (363533L)
- Description
- No such Replication server site exists.
- Name
- VL DUPREPSERVER
- Value
- (363534L)
- Description
- Replication site already exists.
- Name
- RL RWNOTFOUND
- Value
- (363535L)
- Description
- Parent R/W entry not found.
- Name
- VL BADREFCOUNT
- Value
- (363536L)
- Description
- Illegal Reference Count number.
- Name
- VL SIZEEXCEEDED
- Value
- (363537L)
- Description
- Vl size for attributes exceeded.
- Name
- VL BADENTRY
- Value
- (363538L)
- Description
- Bad incoming vl entry.
- Name
- VL BADVOLIDBUMP
- Value
- (363539L)
- Description
- Illegal max volid increment.
- Name
- VL IDALREADYHASHED
- Value
- (363540L)
- Description
- RO/BACK id already hashed.
- Name
- VL ENTRYLOCKED
- Value
- (363541L)
- Description
- Vl entry is already locked.
- Name
- VL BADVOLOPER
- Value
- (363542L)
- Description
- Bad volume operation code.
- Name
- VL BADRELLOCKTYPE
- Value
- (363543L)
- Description
- Bad release lock type.
- Name
- VL RERELEASE
- Value
- (363544L)
- Description
- Status report: last release was aborted.
- Name
- VL BADSERVERFLAG
- Value
- (363545L)
- Description
- Invalid replication site server flag.
- Name
- VL PERM
- Value
- (363546L)
- Description
- No permission access.
- Name
- VL NOMEM
- Value
- (363547L)
- Description
- malloc(realloc) failed to alloc enough memory.
\section sec3-5 Section 3.5: Macros
- The Volume Location Server defines a small number of macros, as described in this section. They are used to update the internal statistics variables and to compute offsets into character strings. All of these macros really refer to internal operations, and strictly speaking should not be exposed in this interface.
\subsection sec3-5-1 Section 3.5.1: COUNT REQ()
#define COUNT_REQ(op)
static int this_op = op-VL_LOWEST_OPCODE;
dynamic_statistics.requests[this_op]++
- Bump the appropriate entry in the variable maintaining opcode usage statistics for the Volume Location Server. Note that a static variable is set up to record this op, namely the index into the opcode monitoring array. This static variable is used by the related COUNT ABO() macro defined below.
\subsection sec3-5-2 Section 3.5.2: COUNT ABO()
#define COUNT_ABO dynamic_statistics.aborts[this_op]++
- Bump the appropriate entry in the variable maintaining opcode abort statistics for the Volume Location Server. Note that this macro does not take any arguemnts. It expects to find a this op variable in its environment, and thus depends on its related macro, COUNT REQ() to define that variable.
\subsection sec3-5-3 Section 3.5.3: DOFFSET()
#define DOFFSET(abase, astr, aitem) ((abase)+(((char *)(aitem)) -((char
)(astr))))
- Compute the byte offset of charcter object aitem within the enclosing object astr, also expressed as a character-based object, then offset the resulting address by abase. This macro is used ot compute locations within the VLDB when actually writing out information.
\section sec3-6 Section 3.6: Functions
- This section covers the Volume Location Server RPC interface routines. The majority of them are generated from the vldbint.xg Rxgen file, and are meant to be used by user-space agents. There is also a subset interface definition provided in the afsvlint.xg Rxgen file. These routines, described in Section 3.7, are meant to be used by a kernel-space agent when dealing with the Volume Location Server; in particular, they are called by the Cache Manager.
\subsection sec3-6-1 Section 3.6.1: VL CreateEntry - Create a VLDB
entry
int VL CreateEntry(IN struct rx connection *z conn,
IN vldbentry *newentry)
- Description
- This function creates a new entry in the VLDB, as specified in the newentry argument. Both the name and numerical ID of the new volume must be unique (e.g., it must not already appear in the VLDB). For non-read-write entries, the read-write parent volume is accessed so that its reference count can be updated, and the new entry is added to the parent's chain of associated entries. The VLDB is write-locked for the duration of this operation.
- Error Codes
- VL PERM The caller is not authorized to execute this function. VL NAMEEXIST The volume name already appears in the VLDB. VL CREATEFAIL Space for the new entry cannot be allocated within the VLDB. VL BADNAME The volume name is invalid. VL BADVOLTYPE The volume type is invalid. VL BADSERVER The indicated server information is invalid. VL BADPARTITION The indicated partition information is invalid. VL BADSERVERFLAG The server flag field is invalid. VL IO An error occurred while writing to the VLDB.
\subsection sec3-6-2 Section 3.6.2: VL DeleteEntry - Delete a VLDB
entry
int VL DeleteEntry(IN struct rx connection *z conn,
IN long Volid,
IN long voltype)
- Description
- Delete the entry matching the given volume identifier and volume type as specified in the Volid and voltype arguments. For a read-write entry whose reference count is greater than 1, the entry is not actually deleted, since at least one child (read-only or backup) volume still depends on it. For cases of non-read-write volumes, the parent's reference count and associated chains are updated.
- If the associated VLDB entry is already marked as deleted (i.e., its flags field has the VLDELETED bit set), then no further action is taken, and VL ENTDELETED is returned. The VLDB is write-locked for the duration of this operation.
- Error Codes
- VL PERM The caller is not authorized to execute this function. VL BADVOLTYPE An illegal volume type has been specified by the voltype argument. VL NOENT This volume instance does not appear in the VLDB. VL ENTDELETED The given VLDB entry has already been marked as deleted. VL IO An error occurred while writing to the VLDB.
\subsection sec3-6-3 Section 3.6.3: VL GetEntryByID - Get VLDB entry by
volume ID/type
int VL GetEntryByID(IN struct rx connection *z conn, IN long Volid, IN long
voltype, OUT vldbentry *entry)
- Description
- Given a volume's numerical identifier (Volid) and type (voltype), return a pointer to the entry in the VLDB describing the given volume instance.
- The VLDB is read-locked for the duration of this operation.
- Error Codes
- VL BADVOLTYPE An illegal volume type has been specified by the voltype argument.
VL NOENT This volume instance does not appear in the VLDB.
VL ENTDELETED The given VLDB entry has already been marked as deleted. \subsection sec3-6-4 Section 3.6.4: VL GetEntryByName - Get VLDB entry
by volume name
int VL GetEntryByName(IN struct rx connection *z conn,
IN char *volumename,
OUT vldbentry *entry)
- Description
- Given the volume name in the volumename parameter, return a pointer to the entry in the VLDB describing the given volume. The name in volumename may be no longer than MAXNAMELEN (65) characters, including the trailing null. Note that it is legal to use the volume's numerical identifier (in string form) as the volume name.
- The VLDB is read-locked for the duration of this operation.
- This function is closely related to the VL GetEntryByID() routine, as might be expected. In fact, the by-ID routine is called if the volume name provided in volumename is the string version of the volume's numerical identifier.
- Error Codes
- VL BADVOLTYPE An illegal volume type has been specified by the voltype argument.
VL NOENT This volume instance does not appear in the VLDB.
VL ENTDELETED The given VLDB entry has already been marked as deleted.
VL BADNAME The volume name is invalid. \subsection sec3-6-5 Section 3.6.5: VL GetNewVolumeId - Generate a new
volume ID
int VL GetNewVolumeId(IN struct rx connection *z conn,
IN long bumpcount,
OUT long *newvolumid)
- Description
- Acquire bumpcount unused, consecutively-numbered volume identifiers from the Volume Location Server. The lowest-numbered of the newly-acquired set is placed in the newvolumid argument. The largest number of volume IDs that may be generated with any one call is bounded by the MAXBUMPCOUNT constant defined in Section 3.2.1. Currently, there is (effectively) no restriction on the number of volume identifiers that may thus be reserved in a single call.
- The VLDB is write-locked for the duration of this operation.
- Error Codes
- VL PERM The caller is not authorized to execute this function.
VL BADVOLIDBUMP The value of the bumpcount parameter exceeds the system limit of MAXBUMPCOUNT.
VL IO An error occurred while writing to the VLDB. \subsection sec3-6-6 Section 3.6.6: VL ReplaceEntry - Replace entire
contents of VLDB entry
int VL ReplaceEntry(IN struct rx connection *z conn,
IN long Volid,
IN long voltype,
IN vldbentry *newentry,
IN long ReleaseType)
- Description
- Perform a wholesale replacement of the VLDB entry corresponding to the volume instance whose identifier is Volid and type voltype with the information contained in the newentry argument. Individual VLDB entry fields cannot be selectively changed while the others are preserved; VL UpdateEntry() should be used for this objective. The permissible values for the ReleaseType parameter are defined in Section 3.2.7.
- The VLDB is write-locked for the duration of this operation. All of the hash tables impacted are brought up to date to incorporate the new information.
- Error Codes
- VL PERM The caller is not authorized to execute this function.
VL BADVOLTYPE An illegal volume type has been specified by the voltype argument.
VL BADRELLOCKTYPE An illegal release lock has been specified by the ReleaseType argument.
VL NOENT This volume instance does not appear in the VLDB.
VL BADENTRY An attempt was made to change a read-write volume ID.
VL IO An error occurred while writing to the VLDB. \subsection sec3-6-7 Section 3.6.7: VL UpdateEntry - Update contents of
VLDB entry
int VL UpdateEntry(IN struct rx connection *z conn,
IN long Volid,
IN long voltype,
IN VldbUpdateEntry *UpdateEntry,
IN long ReleaseType)
- Description
- Update the VLDB entry corresponding to the volume instance whose identifier is Volid and type voltype with the information contained in the UpdateEntry argument. Most of the entry's fields can be modified in a single call to VL UpdateEntry(). The Mask field within the UpdateEntry parameter selects the fields to update with the values stored within the other UpdateEntry fields. Permissible values for the ReleaseType parameter are defined in Section 3.2.7.
- The VLDB is write-locked for the duration of this operation.
- Error Codes
- VL PERM The caller is not authorized to execute this function.
VL BADVOLTYPE An illegal volume type has been specified by the voltype argument.
VL BADRELLOCKTYPE An illegal release lock has been specified by the ReleaseType argument.
VL NOENT This volume instance does not appear in the VLDB.
VL IO An error occurred while writing to the VLDB. \subsection sec3-6-8 Section 3.6.8: VL SetLock - Lock VLDB entry
int VL SetLock(IN struct rx connection *z conn,
IN long Volid,
IN long voltype,
IN long voloper)
- Description
- Lock the VLDB entry matching the given volume ID (Volid) and type (voltype) for volume operation voloper (e.g., VLOP MOVE and VLOP RELEASE). If the entry is currently unlocked, then its LockTimestamp will be zero. If the lock is obtained, the given voloper is stamped into the flags field, and the LockTimestamp is set to the time of the call. \Note When the caller attempts to lock the entry for a release operation, special care is taken to abort the operation if the entry has already been locked for this operation, and the existing lock has timed out. In this case, VL SetLock() returns VL RERELEASE.
- The VLDB is write-locked for the duration of this operation.
- Error Codes
- VL PERM The caller is not authorized to execute this function.
VL BADVOLTYPE An illegal volume type has been specified by the voltype argument.
VL BADVOLOPER An illegal volume operation was specified in the voloper argument. Legal values are defined in the latter part of the table in Section 3.2.5.
VL ENTDELETED The given VLDB entry has already been marked as deleted.
VL ENTRYLOCKED The given VLDB entry has already been locked (which has not yet timed out).
VL RERELEASE A VLDB entry locked for release has timed out, and the caller also wanted to perform a release operation on it.
VL IO An error was experienced while attempting to write to the VLDB. \subsection sec3-6-9 Section 3.6.9: VL ReleaseLock - Unlock VLDB entry
int VL ReleaseLock(IN struct rx connection *z conn,
IN long Volid,
IN long voltype,
IN long ReleaseType)
- Description
- Unlock the VLDB entry matching the given volume ID (Volid) and type (voltype). The ReleaseType argument determines which VLDB entry fields from flags and LockAfsId will be cleared along with the lock timestamp in LockTimestamp. Permissible values for the ReleaseType parameter are defined in Section 3.2.7.
- The VLDB is write-locked for the duration of this operation.
- Error Codes
- VL PERM The caller is not authorized to execute this function.
VL BADVOLTYPE An illegal volume type has been specified by the voltype argument.
VL BADRELLOCKTYPE An illegal release lock has been specified by the ReleaseType argument.
VL NOENT This volume instance does not appear in the VLDB.
VL ENTDELETED The given VLDB entry has already been marked as deleted.
VL IO An error was experienced while attempting to write to the VLDB. \subsection sec3-6-10 Section 3.6.10: VL ListEntry - Get contents of
VLDB via index
int VL ListEntry(IN struct rx connection *z conn,
IN long previous index,
OUT long *count,
OUT long *next index,
OUT vldbentry *entry)
- Description
- This function assists in the task of enumerating the contents of the VLDB. Given an index into the database, previous index, this call return the single VLDB entry at that offset, placing it in the entry argument. The number of VLDB entries left to list is placed in count, and the index of the next entry to request is returned in next index. If an illegal index is provided, count is set to -1.
- The VLDB is read-locked for the duration of this operation.
- Error Codes
- —None.
\subsection sec3-6-11 Section 3.6.11: VL ListAttributes - List all VLDB
entry matching given attributes, single return object
int VL ListAttributes(IN struct rx connection *z conn,
IN VldbListByAttributes *attributes,
OUT long *nentries,
OUT bulkentries *blkentries)
- Description
- Retrieve all the VLDB entries that match the attributes listed in the attributes parameter, placing them in the blkentries object. The number of matching entries is placed in nentries. Matching can be done by server number, partition, volume type, flag, or volume ID. The legal values to use in the attributes argument are listed in Section 3.2.3. Note that if the VLLIST VOLUMEID bit is set in attributes, all other bit values are ignored and the volume ID provided is the sole search criterion.
- The VLDB is read-locked for the duration of this operation.
- Note that VL ListAttributes() is a potentially expensive function, as sequential search through all of the VLDB entries is performed in most cases.
- Error Codes
- VL NOMEM Memory for the blkentries object could not be allocated.
VL NOENT This specified volume instance does not appear in the VLDB.
VL SIZEEXCEEDED Ran out of room in the blkentries object.
VL IO Error while reading from the VLDB. \subsection sec3-6-12 Section 3.6.12: VL LinkedList - List all VLDB
entry matching given attributes, linked list return object
int VL LinkedList(IN struct rx connection *z conn,
IN VldbListByAttributes *attributes,
OUT long *nentries,
OUT vldb list *linkedentries)
- Description
- Retrieve all the VLDB entries that match the attributes listed in the attributes parameter, creating a linked list of entries based in the linkedentries object. The number of matching entries is placed in nentries. Matching can be done by server number, partition, volume type, flag, or volume ID. The legal values to use in the attributes argument are listed in Section 3.2.3. Note that if the VLLIST VOLUMEID bit is set in attributes, all other bit values are ignored and the volume ID provided is the sole search criterion.
- The VL LinkedList() function is identical to the VL ListAttributes(), except for the method of delivering the VLDB entries to the caller.
- The VLDB is read-locked for the duration of this operation.
- Error Codes
- VL NOMEM Memory for an entry in the list based at linkedentries object could not be allocated.
VL NOENT This specified volume instance does not appear in the VLDB.
VL SIZEEXCEEDED Ran out of room in the current list object.
VL IO Error while reading from the VLDB. \subsection sec3-6-13 Section 3.6.13: VL GetStats - Get Volume Location
Server statistics
int VL GetStats(IN struct rx connection *z conn,
OUT vldstats *stats,
OUT vital vlheader *vital header)
- Description
- Collect the different types of VLDB statistics. Part of the VLDB header is returned in vital header, which includes such information as the number of allocations and frees performed, and the next volume ID to be allocated. The dynamic per-operation stats are returned in the stats argument, reporting the number and types of operations and aborts.
- The VLDB is read-locked for the duration of this operation.
- Error Codes
- VL PERM The caller is not authorized to execute this function.
\subsection sec3-6-14 Section 3.6.14: VL Probe - Verify Volume Location
Server connectivity/status
int VL Probe(IN struct rx connection *z conn)
- Description
- This routine serves a 'pinging' function to determine whether the Volume Location Server is still running. If this call succeeds, then the Volume Location Server is shown to be capable of responding to RPCs, thus confirming connectivity and basic operation.
- The VLDB is not locked for this operation.
- Error Codes
- —None.
\section sec3-7 Section 3.7: Kernel Interface Subset
- The interface described by this document so far applies to user-level clients, such as the vos utility. However, some volume location operations must be performed from within the kernel. Specifically, the Cache Manager must find out where volumes reside and otherwise gather information about them in order to conduct its business with the File Servers holding them. In order to support Volume Location Server interconnection for agents operating within the kernel, the afsvlint.xg Rxgen interface was built. It is a minimal subset of the user-level vldbint.xg definition. Within afsvlint.xg, there are duplicate definitions for such constants as MAXNAMELEN, MAXNSERVERS, MAXTYPES, VLF RWEXISTS, VLF ROEXISTS, VLF BACKEXISTS, VLSF NEWREPSITE, VLSF ROVOL, VLSF RWVOL, and VLSF BACKVOL. Since the only operations the Cache Manager must perform are volume location given a specific volume ID or name, and to find out about unresponsive Volume Location Servers, the following interface routines are duplicated in afsvlint.xg, along with the struct vldbentry declaration:
- The Volume Server allows administrative tasks and probes to be performed on the set of AFS volumes residing on the machine on which it is running. As described in Chapter 2, a distributed database holding volume location info, the VLDB, is used by client applications to locate these volumes. Volume Server functions are typically invoked either directly from authorized users via the vos utility or by the AFS backup system.
- This chapter briefly discusses various aspects of the Volume Server's architecture. First, the high-level on-disk representation of volumes is covered. Then, the transactions used in conjuction with volume operations are examined. Then, the program implementing the Volume Server, volserver, is considered. The nature and format of the log file kept by the Volume Server rounds out the description. As with all AFS servers, the Volume Server uses the Rx remote procedure call package for communication with its clients.
\section sec4-2 Section 4.2: Disk Representation
- For each volume on an AFS partition, there exists a file visible in the unix name space which describes the contents of that volume. By convention, each of these files is named by concatenating a prefix string, "V", the numerical volume ID, and the postfix string ".vol". Thus, file V0536870918.vol describes the volume whose numerical ID is 0536870918. Internally, each per-volume descriptor file has such fields as a version number, the numerical volume ID, and the numerical parent ID (useful for read-only or backup volumes). It also has a list of related inodes, namely files which are not visible from the unix name space (i.e., they do not appear as entries in any unix directory object). The set of important related inodes are:
- Volume info inode: This field identifies the inode which hosts the on-disk representation of the volume's header. It is very similar to the information pointed to by the volume field of the struct volser trans defined in Section 5.4.1, recording important status information for the volume.
- Large vnode index inode: This field identifies the inode which holds the list of vnode identifiers for all directory objects residing within the volume. These are "large" since they must also hold the Access Control List (ACL) information for the given AFS directory.
- Small vnode index inode: This field identifies the inode which holds the list of vnode identifiers for all non-directory objects hosted by the volume.
- All of the actual files and directories residing within an AFS volume, as identified by the contents of the large and small vnode index inodes, are also free-floating inodes, not appearing in the conventional unix name space. This is the reason the vendor-supplied fsck program should not be run on partitions containing AFS volumes. Since the inodes making up AFS files and directories, as well as the inodes serving as volume indices for them, are not mapped to any directory, the standard fsck program would throw away all of these "unreferenced" inodes. Thus, a special version of fsck is provided that recognizes partitions containing AFS volumes as well as standard unix partitions.
\section sec4-3 Section 4.3: Transactions
- Each individual volume operation is carried out by the Volume Server as a transaction, but not in the atomic sense of the word. Logically, creating a Volume Server transaction can be equated with performing an "exclusive open" on the given volume before beginning the actual work of the desired volume operation. No other Volume Server (or File Server) operation is allowed on the opened volume until the transaction is terminated. Thus, transactions in the context of the Volume Server serve to provide mutual exclusion without any of the normal atomicity guarantees. Volumes maintain enough internal state to enable recovery from interrupted or failed operations via use of the salvager program. Whenever volume inconsistencies are detected, this salvager program is run, which then attempts to correct the problem.
- Volume transactions have timeouts associated with them. This guarantees that the death of the agent performing a given volume operation cannot result in the volume being permanently removed from circulation. There are actually two timeout periods defined for a volume transaction. The first is the warning time, defined to be 5 minutes. If a transaction lasts for more than this time period without making progress, the Volume Server prints a warning message to its log file (see Section 4.5). The second time value associated with a volume transaction is the hard timeout, defined to occur 10 minutes after any progress has been made on the given operation. After this period, the transaction will be unconditionally deleted, and the volume freed for any other operations. Transactions are reference-counted. Progress will be deemed to have occurred for a transaction, and its internal timeclock field will be updated, when:
- The volserver user-level program is run on every AFS server machine, and implements the Volume Server agent. It is responsible for providing the Volume Server interface as defined by the volint.xg Rxgen file.
- The volserver process defines and launches five threads to perform the bulk of its duties. One thread implements a background daemon whose job it is to garbage-collect timed-out transaction structures. The other four threads are RPC interface listeners, primed to accept remote procedure calls and thus perform the defined set of volume operations.
- Certain non-standard configuration settings are made for the RPC subsystem by the volserver program. For example, it chooses to extend the length of time that an Rx connection may remain idle from the default 12 seconds to 120 seconds. The reasoning here is that certain volume operations may take longer than 12 seconds of processing time on the server, and thus the default setting for the connection timeout value would incorrectly terminate an RPC when in fact it was proceeding normally and correctly.
- The volserver program takes a single, optional command line argument. If a positive integer value is provided on the command line, then it shall be used to set the debugging level within the Volume Server. By default, a value of zero is used, specifying that no special debugging output will be generated and fed to the Volume Server log file described below.
\section sec4-5 Section 4.5: Log File
- The Volume Server keeps a log file, recording the set of events of special interest it has encountered. The file is named VolserLog, and is stored in the /usr/afs/logs directory on the local disk of the server machine on which the Volume Server runs. This is a human-readable file, with every entry time-stamped.
- Whenever the volserver program restarts, it renames the current VolserLog file to VolserLog.old, and starts up a fresh log. A properly-authorized individual can easily inspect the log file residing on any given server machine. This is made possible by the BOS Server AFS agent running on the machine, which allows the contents of this file to be fetched and displayed on the caller's machine via the bos getlog command.
- An excerpt from a Volume Server log file follows below. The numbers appearing in square brackets at the beginning of each line have been inserted so that we may reference the individual lines of the log excerpt in the following paragraph.
[1] Wed May 8 06:03:00 1991 AttachVolume: Error attaching volume
/vicepd/V1969547815.vol; volume needs salvage
[2] Wed May 8 06:03:01 1991 Volser: ListVolumes: Could not attach volume
1969547815
[3] Wed May 8 07:36:13 1991 Volser: Clone: Cloning volume 1969541499 to new
volume 1969541501
[4] Wed May 8 11:25:05 1991 AttachVolume: Cannot read volume header
/vicepd/V1969547415.vol
[5] Wed May 8 11:25:06 1991 Volser: CreateVolume: volume 1969547415
(bld.dce.s3.dv.pmax_ul3) created
- Line [1] indicates that the volume whose numerical ID is 1969547815 could not be attached on partition /vicepd. This error is probably the result of an aborted transaction which left the volume in an inconsistent state, or by actual damage to the volume structure or data. In this case, the Volume Server recommends that the salvager program be run on this volume to restore its integrity. Line [2] records the operation which revealed this situation, namely the invocation of an AFSVolListVolumes() RPC.
- Line [4] reveals that the volume header file for a specific volume could not be read. Line [5], as with line [2] in the above paragraph, indicates why this is true. Someone had called the AFSVolCreateVolume() interface function, and as a precaution, the Volume Server first checked to see if such a volume was already present by attempting to read its header.
- Thus verifying that the volume did not previously exist, the Volume Server allowed the AFSVolCreateVolume() call to continue its processing, creating and initializing the proper volume file, V1969547415.vol, and the associated header and index inodes.
\page chap5 Chapter 5: Volume Server Interface
\section sec5-1 Section 5.1 Introduction
- This chapter documents the API for the Volume Server facility, as defined by the volint.xg Rxgen interface file and the volser.h include file. Descriptions of all the constants, structures, macros, and interface functions available to the application programmer appear here.
\section sec5-2 Section 5.2: Constants
- This section covers the basic constant definitions of interest to the Volume Server application programmer. These definitions appear in the volint.h file, automatically generated from the volint.xg Rxgen interface file, and in volser.h.
- Each subsection is devoted to describing the constants falling into the following categories:
- These constants define some basic system configuration values, along with such things as maximum sizes of important arrays.
MyPort 5,003 The Rx UDP port on which the Volume Server service may be found.
- Name
- NameLen
- Value
- 80
- Description
- Used by the vos utility to define maximum lengths for internal filename variables.
- Name
- VLDB MAXSERVERS
- Value
- 10
- Description
- Maximum number of server agents implementing the AFS Volume Location Database (VLDB) for the cell.
- Name
- VOLSERVICE ID
- Value
- 4
- Description
- The Rx service number on the given UDP port (MyPort) above.
- Name
- INVALID BID
- Value
- 0
- Description
- Used as an invalid read-only or backup volume ID.
- Name
- VOLSER MAXVOLNAME
- Value
- 65
- Description
- The number of characters in the longest possible volume name, including the trailing null. Note: this is only used by the vos utility; the Volume Server uses the "old" value below.
- Name
- VOLSER OLDMAXVOLNAME
- Value
- 32
- Description
- The "old" maximum number of characters in an AFS volume name, including the trailing null. In reality, it is also the current maximum.
- Name
- VOLSER MAX REPSITES
- Value
- 7
- Description
- The maximum number of replication sites for a volume.
- Name
- VNAMESIZE
- Value
- 32
- Description
- Size in bytes of the name field in struct volintInfo (see Section 5.4.6).
\subsection sec5-2-2 Section 5.2.2: Interface Routine Opcodes
- These constants, appearing in the volint.xg Rxgen interface file for the Volume Server, define the opcodes for the RPC routines. Every Rx call on this interface contains this opcode, and the dispatcher uses it to select the proper code at the server site to carry out the call.
- Name
VOLCREATEVOLUME
- Value
100
- Description
- Opcode for AFSVolCreateVolume()
- Name
VOLDELETEVOLUME
- Value
101
- Description
- Opcode for AFSVolDeleteVolume()
- Name
VOLRESTORE
- Value
102
- Description
- Opcode for AFSVolRestoreVolume()
- Name
VOLFORWARD
- Value
103
- Description
- Opcode for AFSVolForward()
- Name
VOLENDTRANS
- Value
104
- Description
- Opcode for AFSVolEndTrans()
- Name
VOLCLONE
- Value
105
- Description
- Opcode for AFSVolClone() .
- Name
VOLSETFLAGS
- Value
106
- Description
- Opcode for AFSVolSetFlags()
- Name
VOLGETFLAGS
- Value
107
- Description
- Opcode for AFSVolGetFlags()
- Name
VOLTRANSCREATE
- Value
108
- Description
- Opcode for AFSVolTransCreate()
- Name
VOLDUMP
- Value
109
- Description
- Opcode for AFSVolDump()
- Name
VOLGETNTHVOLUME
- Value
110
- Description
- Opcode for AFSVolGetNthVolume()
- Name
VOLSETFORWARDING
- Value
111
- Description
- Opcode for AFSVolSetForwarding()
- Name
VOLGETNAME
- Value
112
- Description
- Opcode for AFSVolGetName()
- Name
VOLGETSTATUS
- Value
113
- Description
- Opcode for AFSVolGetStatus()
- Name
VOLSIGRESTORE
- Value
114
- Description
- Opcode for AFSVolSignalRestore()
- Name
VOLLISTPARTITIONS
- Value
115
- Description
- Opcode for AFSVolListPartitions()
- Name
VOLLISTVOLS
- Value
116
- Description
- Opcode for AFSVolListVolumes()
- Name
VOLSETIDSTYPES
- Value
117
- Description
- Opcode for AFSVolSetIdsTypes()
- Name
VOLMONITOR
- Value
118
- Description
- Opcode for AFSVolMonitor()
- Name
VOLDISKPART
- Value
119
- Description
- Opcode for AFSVolPartitionInfo()
- Name
VOLRECLONE
- Value
120
- Description
- Opcode for AFSVolReClone()
- Name
VOLLISTONEVOL
- Value
121
- Description
- Opcode for AFSVolListOneVolume()
- Name
VOLNUKE
- Value
122
- Description
- Opcode for AFSVolNukeVolume()
- Name
VOLSETDATE
- Value
123
- Description
- Opcode for AFSVolSetDate()
\subsection sec5-2-3 Section 5.2.3: Transaction Flags
- These constants define the various flags the Volume Server uses in assocation with volume transactions, keeping track of volumes upon which operations are currently proceeding. There are three sets of flag values, stored in three different fields within a struct volser trans: general volume state, attachment modes, and specific transaction states.
\subsubsection sec5-2-3-1: Section 5.2.3.1 vflags
- These values are used to represent the general state of the associated volume. They appear in the vflags field within a struct volser trans.
- Name
VTDeleteOnSalvage
- Value
1
- Description
- The volume should be deleted on next salvage.
- Name
VTOutOfService
- Value
2
- Description
- This volume should never be put online.
- Name
VTDeleted
- Value
4
- Description
- This volume has been deleted (via AFSVolDeleteVol¬ume() ), and thus should not be manipulated.
\subsubsection sec5-2-3-2 Section 5.2.3.2: iflags
- These constants represent the desired attachment mode for a volume at the start of a transaction. Once attached, the volume header is marked to reflect this mode. Attachment modes are useful in salvaging partitions, as they indicate whether the operations being performed on individual volumes at the time the crash occured could have introduced inconsistencies in their metadata descriptors. If a volume was attached in a read-only fashion, then the salvager may decide (taking other factors into consideration) that the volume doesn't need attention as a result of the crash.
- These values appear in the iflags field within a struct volser trans.
- Name
ITOffline
- Value
0x1
- Description
- Volume offline on server (returns VOFFLINE).
- Name
ITBusy
- Value
0x2
- Description
- Volume busy on server (returns VBUSY).
- Name
ITReadOnly
- Value
0x8
- Description
- Volume is read-only on client, read-write on server -DO NOT USE.
- Name
ITCreate
- Value
0x10
- Description
- Volume does not exist correctly yet.
- Name
ITCreateVolID
- Value
0x1000
- Description
- Create volid.
\subsubsection sec5-2-3-3 Section 5.2.3.3: tflags
- This value is used to represent the transaction state of the associated volume, and appears in the tflags field within a struct volser trans.
- Name
TTDeleted
- Value
1
- Description
- Delete transaction not yet freed due to high reference count.
\subsection sec5-2-4 Section 5.2.4: Volume Types
- The following constants may be supplied as values for the type argument to the AFSVol-CreateVolume() interface call. They are just synonyms for the three values RWVOL, ROVOL,
- Name
volser RW
- Value
0
- Description
- Specifies a read-write volume type.
- Name
volser RO
- Value
1
- Description
- Specifies a read-only volume type.
- Name
volser BACK
- Value
2
- Description
- Specifies a backup volume type.
\subsection sec5-2-5 Section 5.2.5: LWP State
- This set of exported definitions refers to objects internal to the Volume Server, and strictly speaking should not be visible to other agents. Specifically, a busyFlags array keeps a set of flags referenced by the set of lightweight threads running within the Volume Server. These flags reflect and drive the state of each of these worker LWPs.
- Name
VHIdle
- Value
1
- Description
- Volume Server LWP is idle, waiting for new work.
- Name
VHRequest
- Value
2
- Description
- A work item has been queued.
\subsection sec5-2-6 Section 5.2.6: States for struct vldbentry
- The Volume Server defines a collection of synonyms for certain values defined by the Volume Location Server. These particular constants are used within the flags field in objects of type struct vldbentry. The equivalent Volume Location Server values are described in Section 3.2.6.
- Name
RW EXISTS
- Value
0x1000
- Description
- Synonym for VLF RWEXISTS.
- Name
RO EXISTS
- Value
0x2000
- Description
- Synonym for VLF ROEXISTS.
- Name
BACK EXISTS
- Value
0x4000
- Description
- Synonym for VLF BACKEXISTS.
- Name
NEW REPSITE
- Value
0x01
- Description
- Synonym for VLSF NEWREPSITE.
- Name
ITSROVOL
- Value
0x02
- Description
- Synonym for VLFS ROVOL.
- Name
ITSRWVOL
- Value
0x04
- Description
- Synonym for VLSF RWVOL.
- Name
ITSBACKVOL
- Value
0x08
- Description
- Synonym for VLSF BACKVOL.
\subsection sec5-2-7 Section 5.2.7: Validity Checks
- These values are used for performing validity checks. The first one appears only within the partFlags field within objects of type partList (see Section 5.4.3). The rest (except VOK and VBUSY) appear in the volFlags field within an object of type struct volDescription. These latter defintions are used within the volFlags field to mark whether the rest of the fields within the struct volDescription are valid. Note that while several constants are defined, only some are actually used internally by the Volume Server code.
- Name
PARTVALID
- Value
0x01
- Description
- The indicated partition is valid.
- Name
CLONEVALID
- Value
0x02
- Description
- The indicated clone (field volCloneId) is a valid one.
- Name
CLONEZAPPED
- Value
0x04
- Description
- The indicated clone volume (field volCloneId) has been deleted.
- Name
IDVALID
- Value
0x08
- Description
- The indicated volume ID (field volId) is valid.
- Name
NAMEVALID
- Value
0x10
- Description
- The indicted volume name (field volName) is valid. Not used internally by the Volume Server.
- Name
SIZEVALID
- Value
0x20
- Description
- The indicated volume size (field volSize) is valid. Not used internally by the Volume Server.
- Name
ENTRYVALID
- Value
0x40
- Description
- The struct volDescription refers to a valid volume.
- Name
REUSECLONEID
- Value
0x80
- Description
- The indicated clone ID (field volCloneId) should be reused.
- Name
VOK
- Value
0x02
- Description
- Used in the status field of struct volintInfo to show that everything is OK.
- Name
VBUSY
- Value
110
- Description
- Used in the status field of struct volintInfo to show that the volume is currently busy.
\subsection sec5-2-8 Section 5.2.8: Miscellaneous
- This section covers the set of exported Volume Server definitions that don't easily fall into the above categories.
- Name
SIZE
- Value
1,024
- Description
- Not used internally by the Volume Server; used as a maxi¬mum size for internal character arrays.
- Name
MAXHELPERS
- Value
10
- Description
- Size of an internal Volume Server character array (busyFlags), it marks the maximum number of threads within the server.
- Name
STDERR
- Value
stderr
- Description
- Synonym for the unix standard input file descriptor.
- Name
STDOUT
- Value
stdout
- Description
- Synonym for the unix standard output file descriptor.
\section sec5-3 Section 5.3: Exported Variables
- This section describes the single variable that the Volume Server exports to its applications.
- The QI GlobalWriteTrans exported variable represents a pointer to the head of the global queue of transaction structures for operations being handled by a Volume Server. Each object in this list is of type struct volser trans (see Section 5.4.1 below).
\section sec5-4 Section 5.4: Structures and Typedefs
- This section describes the major exported Volume Server data structures of interest to application programmers, along with some of the the typedefs based on those structures. Please note that typedefs in shose definitions angle brackets appear are those fed through the Rxgen RPC stub generator. Rxgen uses these angle brackets to specify an array of indefinite size.
\subsection sec5-4-1 Section 5.4.1: struct volser trans
- This structure defines the transaction record for all volumes upon which an active operation is proceeding.
Fields
- This structure is used by the AFS backup system to group certain key fields of volume information.
Fields
- This structure is used by the backup system and the vos tool to keep track of the state of the AFS disk partitions on a given server.
Fields
- This structure holds the status of a volume as it is known to the Volume Server, and is passed to clients through the AFSVolGetStatus() interface call.
- Two fields appearing in this structure, accessDate and updateDate, deserve a special note. In particular, it is important to observe that these fields are not kept in full synchrony with reality. When a File Server provides one of its client Cache Managers with a chunk of a file on which to operate, it is incapable of determining exactly when the data in that chunk is accessed, or exactly when it is updated. This is because the manipulations occur on the client machine, without any information on these accesses or updates passed back to the server. The only time these fields can be modified is when the chunk of a file resident within the given volume is delivered to a client (in the case of accessDate), or when a client writes back a dirty chunk to the File Server (in the case of updateDate).
Fields
- Used to specify the destination server in an AFSVolForward() invocation (see Section 5.7.7).
Fields
- This structure is used to communicate volume information to the Volume Server's RPC clients. It is used to build the volEntries object, which appears as a parameter to the AFSVolListVolumes() call.
- The comments in Section 5.4.4 concerning the accessDate and updateDate fields are equally valid for the analogue fields in this structure.
Fields
- This structure is provided for monitoring and debugging purposes. It is used to compose the transDebugEntries variable-sized object, which in turn appears as a parameter to the AFSVolMonitor() interface call.
Fields
- Used by the AFSVolListPartitions() interface call, this structure is used to store information on all of the partitions on a given Volume Server.
Fields
- This structure contains information regarding an individual AFS disk partition. It is returned as a parameter to the AFSVolPartitionInfo() call.
Fields
- Used as a parameter to both AFSVolRestore() and AFSVolForward(),a restoreCookie keeps information that must be preserved between various Volume Server operations.
Fields
typedef transDebugInfo transDebugEntries<>;
- This typedef is used to generate a variable-length object which is passed as a parameter to the AFSVolMonitor() interface function. Thus, it may carry any number of descriptors for active transactions on the given Volume Server. Specifi, it causes a C structure of the same name to be defined with the following fields:
Fields
typedef volintInfo volEntries<>;
- This typedef is used to generate a variable-length object which is passed as a parameter to AFSVolListVolumes(). Thus, it may carry any number of descriptors for volumes on the given Volume Server. Specifically, it causes a C structure of the same name to be defined with the following fields:
Fields
- The Volume Server advertises two groups of error codes. The first set consists of the standard error codes defined by the package. The second is a collection of lower-level return values which are exported here for convenience.
- Name
VOLSERTRELE ERROR
- Value
1492325120L
- Description
- internal error releasing transaction.
- Name
VOLSERNO OP
- Value
1492325121L
- Description
- unknown internal error.
- Name
VOLSERREAD DUMPERROR
- Value
1492325122L
- Description
- badly formatted dump.
- Name
VOLSERDUMPERROR
- Value
1492325123L
- Description
- badly formatted dump(2).
- Name
VOLSERATTACH ERROR
- Value
1492325124L
- Description
- could not attach volume.
- Name
VOLSERILLEGAL PARTITION
- Value
1492325125L
- Description
- illegal partition.
- Name
VOLSERDETACH ERROR
- Value
1492325126L
- Description
- could not detach volume.
- Name
VOLSERBAD ACCESS
- Value
1492325127L
- Description
- insufficient privilege for volume operation.
- Name
VOLSERVLDB ERROR
- Value
1492325128L
- Description
- error from volume location database.
- Name
VOLSERBADNAME
- Value
1492325129L
- Description
- bad volume name.
- Name
VOLSERVOLMOVED
- Value
1492325130L
- Description
- volume moved.
- Name
VOLSERBADOP
- Value
1492325131L
- Description
- illegal volume operation.
- Name
VOLSERBADRELEASE
- Value
1492325132L
- Description
- volume release failed.
- Name
VOLSERVOLBUSY
- Value
1492325133L
- Description
- volume still in use by volserver.
- Name
VOLSERNO MEMORY
- Value
1492325134L
- Description
- out of virtual memory in volserver.
- Name
VOLSERNOVOL
- Value
1492325135L
- Description
- no such volume.
- Name
VOLSERMULTIRWVOL
- Value
1492325136L
- Description
- more than one read/write volume.
- Name
VOLSERFAILEDOP
- Value
1492325137L
- Description
- failed volume server operation.
\subsection sec5-5-1 Section 5.5.1: Standard
- The error codes described in this section were defined by the Volume Server to describe exceptional conditions arising in the course of RPC call handling.
\subsection sec5-5-2 Section 5.5.2: Low-Level
- These error codes are duplicates of those defined from a package which is internal to the Volume Server. They are re-defined here to make them visible to Volume Server clients.
- Name
VSALVAGE
- Value
101
- Description
- Volume needs to be salvaged.
- Name
VNOVNODE
- Value
102
- Description
- Bad vnode number encountered.
- Name
VNOVOL
- Value
103
- Description
- The given volume is either not attached, doesn't exist, or is not online.
- Name
VVOLEXISTS
- Value
104
- Description
- The given volume already exists.
- Name
VNOSERVICE
- Value
105
- Description
- The volume is currently not in service.
- Name
VOFFLINE
- Value
106
- Description
- The specified volume is offline, for the reason given in the offline message field (a subfield within the volume field in struct volser trans).
- Name
VONLINE
- Value
107
- Description
- Volume is already online.
- Name
VDISKFULL
- Value
108
- Description
- The disk partition is full.
- Name
VOVERQUOTA
- Value
109
- Description
- The given volume's maximum quota, as expressed in the maxQuota field of the struct volintInfo, has been exceeded.
- Name
VBUSY
- Value
110
- Description
- The named volume is temporarily unavailable, and the client is encouraged to retry the operation shortly.
- Name
VMOVED
- Value
111
- Description
- The given volume has moved to a new server.
- The VICE SPECIAL ERRORS constant is defined to be the lowest of these error codes.
\section sec5-6 Section 5.6: Macros
- The Volume Server defines a small number of macros, as described in this section.
Section 5.6.1: THOLD()
#define THOLD(tt) ((tt)->refCount++)
- This macro is used to increment the reference count field, refCount, in an object of type struct volser trans. Thus, the associated transaction is effectively "held" insuring it won't be garbage-collected. The counterpart to this operation, TRELE(), is implemented by the Volume Server as a function.
\subsection sec5-6-2 Section 5.6.2: ISNAMEVALID()
#define ISNAMEVALID(name) (strlen(name) < (VOLSER_OLDMAXVOLNAME -9))
- This macro checks to see if the given name argument is of legal length. It must be no more than the size of the container, which is at most VOLSER OLDMAXVOLNAME characters, minus the length of the longest standardized volume name postfix known to the system. That postfix is the 9-character .restored string, which is tacked on to the name of a volume that has been restored from a dump.
\section sec5-7 Section 5.7: Functions
- This section covers the Volume Server RPC interface routines, defined by and generated from the volint.xg Rxgen file. The following is a summary of the interface functions and their purpose:
- Fcn Name
AFSVolCreateVolume
- Description
- Create a volume.
- Fcn Name
AFSVolDeleteVolume
- Description
- Delete a volume.
- Fcn Name
AFSVolNukeVolume
- Description
- Obliterate a volume completely.
- Fcn Name
AFSVolDump
- Description
- Dump (i.e., save) the contents of a volume.
- Fcn Name
AFSVolSignalRestore
- Description
- Show intention to call AFSVolRestore().
- Fcn Name
AFSVolRestore
- Description
- Recreate a volume from a dump.
- Fcn Name
AFSVolForward
- Description
- Dump a volume, then restore to a given server and volume.
- Fcn Name
AFSVolClone
- Description
- Clone (and optionally purge) a volume.
- Fcn Name
AFSVolReClone
- Description
- Re-clone a volume.
- Fcn Name
AFSVolSetForwarding
- Description
- Set forwarding info for a moved volume.
- Fcn Name
AFSVolTransCreate
- Description
- Create transaction for a [volume, partition].
- Fcn Name
AFSVolEndTrans
- Description
- End a transaction.
- Fcn Name
AFSVolGetFlags
- Description
- Get volume flags for a transaction.
- Fcn Name
AFSVolSetFlags
- Description
- Set volume flags for a transaction.
- Fcn Name
AFSVolGetName
- Description
- Get the volume name associated with a transaction.
- Fcn Name
AFSVolGetStatus
- Description
- Get status of a transaction/volume.
- Fcn Name
AFSVolSetIdsTypes
- Description
- Set header info for a volume.
- Fcn Name
AFSVolSetDate
- Description
- Set creation date in a volume.
- Fcn Name
AFSVolListPartitions
- Description
- Return a list of AFS partitions on a server.
- Fcn Name
AFSVolPartitionInfo
- Description
- Get partition information.
- Fcn Name
AFSVolListVolumes
- Description
- Return a list of volumes on the server.
- Fcn Name
AFSVolListOneVolume
- Description
- Return header info for a single volume.
- Fcn Name
AFSVolGetNthVolume
- Description
- Get volume header given its index.
- Fcn Name
AFSVolMonitor
- Description
- Collect server transaction state.
- There are two general comments that apply to most of the Volume Server interface routines:
int AFSVolCreateVolume(IN struct rx connection *z conn,
IN long partition,
IN char *name,
IN long type,
IN long parent,
INOUT long *volid,
OUT long *trans)
- Description
- Create a volume named name, with numerical identifier volid, and of type type. The new volume is to be placed in the specified partition for the server machine as identified by the Rx connection information pointed to by z conn. If a value of 0 is provided for the parent argument, it will be set by the Volume Server to the value of volid itself. The trans parameter is set to the Volume Location Server transaction ID corresponding to the volume created by this call, if successful. The numerical volume identifier supplied in the volid parameter must be generated beforehand by calling VL GetNewVolumeID() (see Section 3.6.5). After AFSVolCreateVolume() completes correctly, the new volume is marked as offline. It must be explicitly brought online through a call to AFSVolSetFlags() (see Section 5.7.14) while passing the trans transaction ID generated by AFSVolCreateVolume(). The "hold" on the new volume guaranteed by the trans transaction may be "released" by calling AFSVolEnd-Trans(). Until then, no other process may operate on the volume. Upon creation, a volume's maximum quota (as specified in the maxquota field of a struct volintInfo) is set to 5,000 1-Kbyte blocks. Note that the AFSVolCreateVolume() routine is the only Volume Server function that manufactures its own transaction. All others must have already acquired a transaction ID via either a previous call to AFSVolCreateVolume() or AFSVolTransCreate().
- Error Codes
- VOLSERBADNAME The volume name parameter was longer than 31 characters plus the trailing null.
VOLSERBAD ACCESS The caller is not authorized to create a volume.
EINVAL The type parameter was illegal. E2BIG A value of 0 was provided in the volid parameter. VOLSERVOLBUSY A transaction could not be created, thus the given volume was busy.
EIO The new volume entry could not be created.
VOLSERTRELE ERROR The trans transaction's reference count could not be dropped to the proper level.
<misc> If the partition parameter is unintelligible, this routine will return a low-level unix error. \subsection sec5-7-2 Section 5.7.2: AFSVolDeleteVolume - Delete a
volume
int AFSVolDeleteVolume(IN struct rx connection *z conn, IN long trans)
- Description
- Delete the volume associated with the open transaction ID specified within trans. All of the file system objects contained within the given volume are destroyed, and the on-disk volume metadata structures are reclaimed. In addition, the in-memory volume descriptor's vflags field is set to VTDeleted, indicating that it has been deleted.
- Under some circumstances, a volume should be deleted by calling AFSVolNukeVolume() instead of this routine. See Section 5.7.3 for more details.
- Error Codes
- VOLSERBAD ACCESS The caller is not authorized to delete a volume.
ENOENT The trans transaction was not found.
VOLSERTRELE ERROR The trans transaction's reference count could not be dropped to the proper level. \subsection sec5-7-3 Section 5.7.3: AFSVolNukeVolume - Obliterate a
volume completely
int AFSVolNukeVolume(IN struct rx connection *z conn,
IN long partID,
IN long volID)
- Description
- Completely obliterate the volume living on partition partID whose ID is volID. This involves scanning all inodes on the given partition and removing those marked with the specified volID. If the volume is a read-only clone, only the header inodes are removed, since they are the only ones stamped with the read-only ID. To reclaim the space taken up by the actual data referenced through a read-only clone, this routine should be called on the read-write master. Note that calling AFSVolNukeVolume() on a read-write volume effectively destroys all the read-only volumes cloned from it, since everything except for their indicies to the (now-deleted) data will be gone.
- Under normal circumstances, it is preferable to use AFSVolDeleteVolume() instead of AFSVolNukeVolume() to delete a volume. The former is much more efficient, as it only touches those objects in the partition that belong to the named volume, walking the on-disk volume metadata structures. However, AFSVolNukeVolume() must be used in situations where the volume metadata structures are known to be damaged. Since a complete scan of all inodes in the partition is performed, all disconnected or unreferenced portions of the given volume will be reclaimed.
- Error Codes
- VOLSERBAD ACCESS The caller is not authorized to call this routine.
VOLSERNOVOL The partition specified by the partID argument is illegal. \subsection sec5-7-4 Section 5.7.4: AFSVolDump - Dump (i.e., save) the
contents of a volume
int AFSVolDump(IN struct rx connection *z conn,
IN long fromTrans,
IN long fromDate)
- Description
- Generate a canonical dump of the contents of the volume associated with transaction fromTrans as of calendar time fromDate. If the given fromDate is zero, then a full dump will be carried out. Otherwise, the resulting dump will be an incremental one.
- This is specified as a split function within the volint.xg Rxgen interface file. This specifies that two routines are generated, namely StartAFSVolDump() and EndAFSVolDump(). The former is used to marshall the IN arguments, and the latter is used to unmarshall the return value of the overall operation. The actual dump data appears in the Rx stream for the call (see the section entitled Example Server and Client in the companion AFS-3 Programmer's Reference: Specification for the Rx Remote Procedure Call Facility document).
- Error Codes
- VOLSERBAD ACCESS The caller is not authorized to dump a volume.
ENOENT The fromTrans transaction was not found.
VOLSERTRELE ERROR The trans transaction's reference count could not be dropped to the proper level. \subsection sec5-7-5 Section 5.7.5: AFSVolSignalRestore - Show
intention to call AFSVolRestore()
int AFSVolSignalRestore(IN struct rx connection *z conn,
IN char *name,
IN int type,
IN long pid,
IN long cloneid)
- Description
- Show an intention to the Volume Server that the client will soon call AFSVolRestore(). The parameters, namely the volume name, type, parent ID pid and clone ID cloneid are stored in a well-known set of global variables. These values are used to set the restored volume's header, overriding those values present in the dump from which the volume will be resurrected.
- Error Codes
- VOLSERBAD ACCESS The caller is not authorized to call this routine.
VOLSERBADNAME The volume name contained in name was longer than 31 characters plus the trailing null. \subsection sec5-7-6 Section 5.7.6: AFSVolRestore - Recreate a volume
from a dump
int AFSVolRestore(IN struct rx connection *z conn,
IN long toTrans,
IN long flags,
IN struct restoreCookie *cookie)
- Description
- Interpret a canonical volume dump (generated as the result of calling AFSVolDumpVolume()), passing it to the volume specified by the toTrans transaction. Only the low bit in the flags argument is inspected. If this low bit is turned on, the dump will be restored as incremental; otherwise, a full restore will be carried out.
- All callbacks to the restored volume are broken.
- This is specified as a split function within the volint.xg Rxgen interface file. This specifies that two routines are generated, namely StartAFSVolRestore() and EndAFSVolRestore() . The former is used to marshall the IN arguments, and the latter is used to unmarshall the return value of the overall operation. The actual dump data flows over the Rx stream for the call (see the section entitled Example Server and Client in the companion AFS-3 Programmer's Reference: Specification for the Rx Remote Procedure Call Facility document).
- The AFSVolSignalRestore() routine (see Section 5.7.5) should be called before invoking this function in order to signal the intention to restore a particular volume.
- Error Codes
- VOLSERREAD DUMPERROR Dump data being restored is corrupt.
VOLSERBAD ACCESS The caller is not authorized to restore a volume.
ENOENT The fromTrans transaction was not found.
VOLSERTRELE ERROR The trans transaction's reference count could not be dropped to the proper level. \subsection sec5-7-7 Section 5.7.7: AFSVolForward - Dump a volume, then
restore to given server and volume
int AFSVolForward(IN struct rx connection *z conn,
IN long fromTrans,
IN long fromDate,
IN struct destServer *destination,
IN long destTrans,
IN struct restoreCookie *cookie)
- Description
- Dumps the volume associated with transaction fromTrans from the given fromDate. The dump itself is sent to the server described by destination, where it is restored as the volume associated with transaction destTrans. In reality, an Rx connection is set up to the destServer, StartAFSVolRestore() directs writing to the Rx call's stream, and then EndAFSVolRestore() is used to deliver the dump for the volume corresponding to fromTrans. If a non-zero fromDate is provided, then the dump will be incremental from that date. Otherwise, a full dump will be delivered.
- The Rx connection set up for this task is always destroyed before the function returns. The destination volume should exist before carrying out this operation, and the invoking process should have started transactions on both participating volumes.
- Error Codes
- VOLSERBAD ACCESS The caller is not authorized to forward a volume.
ENOENT The fromTrans transaction was not found.
VOLSERTRELE ERROR The trans transaction's reference count could not be dropped to the proper level.
ENOTCONN An Rx connection to the destination server could not be established. \subsection sec5-7-8 Section 5.7.8: AFSVolClone - Clone (and optionally
purge) a volume
int AFSVolClone(IN struct rx connection *z conn,
IN long trans,
IN long purgeVol,
IN long newType,
IN char *newName,
INOUT long *newVol)
- Description
- Make a clone of the read-write volume associated with transaction trans, giving the cloned volume a name of newName. The newType parameter specifies the type for the new clone, and may be either ROVOL or BACKVOL. If purgeVol is set to a non-zero value, then that volume will be purged during the clone operation. This may be more efficient that separate clone and purge calls when making backup volumes. The newVol parameter sets the new clone's ID. It is illegal to pass a zero in newVol.
- Error Codes
- VOLSERBADNAME The volume name contained in newName was longer than 31 characters plus the trailing null.
VOLSERBAD ACCESS The caller is not authorized to clone a volume.
ENOENT The fromTrans transaction was not found.
VOLSERTRELE ERROR The trans transaction's reference count could not be dropped to the proper level.
VBUSY The given transaction was already in use; indicating that someone else is currently manipulating the specified clone.
EROFS The volume associated with the given trans is read-only (either ROVOL or BACKVOL).
EXDEV The volume associated with the trans transaction and the one specified by purgeVol must be on the same disk device, and they must be cloned from the same parent volume.
EINVAL The purgeVol must be read-only, i.e. either type ROVOL or BACKVOL. \subsection sec5-7-9 Section 5.7.9: AFSVolReClone - Re-clone a volume
int AFSVolReClone(IN struct rx connection *z conn,
IN long tid,
IN long cloneID)
- Description
- Recreate an existing clone, with identifier cloneID, from the volume associated with transaction tid.
- Error Codes
- VOLSERBAD ACCESS The caller is not authorized to clone a volume.
ENOENT The tid transaction was not found.
VOLSERTRELE ERROR The tid transaction's reference count could not be dropped to the proper level.
VBUSY The given transaction was already in use; indicating that someone else is currently manipulating the specified clone.
EROFS The volume to be cloned must be read-write (of type RWVOL).
EXDEV The volume to be cloned and the named clone itself must be on the same device. Also, cloneID must have been cloned from the volume associated with transaction tid.
EINVAL The target clone must be a read-only volume (i.e., of type ROVOL or BACKVOL). \subsection sec5-7-10 Section 5.7.10: AFSVolSetForwarding - Set
forwarding info for a moved volume
int AFSVolSetForwarding(IN struct rx connection *z conn,
IN long tid,
IN long newsite)
- Description
- Record the IP address specified within newsite as the location of the host which now hosts the volume associated with transaction tid, formerly resident on the current host. This is intended to gently guide Cache Managers who have stale volume location cached to the volume's new site, ensuring the move is transparent to clients using that volume.
- Error Codes
- VOLSERBAD ACCESS The caller is not authorized to create a forwarding address.
ENOENT The trans transaction was not found. \subsection sec5-7-11 Section 5.7.11: AFSVolTransCreate - Create
transaction for a [volume, partition]
int AFSVolTransCreate(IN struct rx connection *z conn,
IN long volume,
IN long partition,
IN long flags,
OUT long *trans)
- Description
- Create a new Volume Server transaction associated with volume ID volume on partition partition. The type of volume transaction is specified by the flags parameter. The values in flags specify whether the volume should be treated as busy (ITBusy), offline (ITOffline), or in shared read-only mode (ITReadOnly). The identifier for the new transaction built by this function is returned in trans.
- Creating a transaction serves as a signal to other agents that may be interested in accessing a volume that it is unavailable while the Volume Server is manipulating it. This prevents the corruption that could result from multiple simultaneous operations on a volume.
- Error Codes
- EINVAL Illegal value encountered in flags.
VOLSERVOLBUSY A transaction could not be created, thus the given [volume, partition] pair was busy.
VOLSERTRELE ERROR The trans transaction's reference count could not be dropped to the proper level after creation. \subsection sec5-7-12 Section 5.7.12: AFSVolEndTrans - End a
transaction
int AFSVolEndTrans(IN struct rx connection *z conn,
IN long trans,
OUT long *rcode)
- Description
- End the transaction identified by trans, returning its final error code into rcode. This makes the associated [volume, partition] pair eligible for further Volume Server operations.
- Error Codes
- VOLSERBAD ACCESS The caller is not authorized to create a transaction.
ENOENT The trans transaction was not found. \subsection sec5-7-13 Section 5.7.13: AFSVolGetFlags - Get volume flags
for a transaction
int AFSVolGetFlags(IN struct rx connection *z conn,
IN long trans,
OUT long *flags)
- Description
- Return the value of the vflags field of the struct volser trans object describing the transaction identified as trans. The set of values placed in the flags parameter is described in Section 5.2.3.1. Briefly, they indicate whether the volume has been deleted (VTDeleted), out of service (VTOutOfService), or marked delete-on-salvage (VTDeleteOnSalvage).
- Error Codes
- ENOENT The trans transaction was not found.
VOLSERTRELE ERROR The trans transaction's reference count could not be dropped to the proper level. \subsection sec5-7-14 Section 5.7.14: AFSVolSetFlags - Set volume flags
for a transaction
int AFSVolSetFlags(IN struct rx connection *z conn,
IN long trans,
IN long flags)
- Description
- Set the value of the vflags field of the struct volser trans object describing the transaction identified as trans to the contents of flags. The set of legal values for the flags parameter is described in Section 5.2.3.1. Briefly, they indicate whether the volume has been deleted (VTDeleted), out of service (VTOutOfService), or marked delete-onsalvage (VTDeleteOnSalvage).
- Error Codes
- ENOENT The trans transaction was not found.
EROFS Updates to this volume are not allowed.
VOLSERTRELE ERROR The trans transaction's reference count could not be dropped to the proper level. \subsection sec5-7-15 Section 5.7.15: AFSVolGetName - Get the volume
name associated with a transaction
int AFSVolGetName(IN struct rx connection *z conn,
IN long tid,
OUT char **tname)
- Description
- Given a transaction identifier tid, return the name of the volume associated with the given transaction. The tname parameter is set to point to the address of a string buffer of at most 256 chars containing the desired information, which is created for this purpose. Note: the caller is responsible for freeing the buffer pointed to by tname when its information is no longer needed.
- Error Codes
- ENOENT The tid transaction was not found, or a volume was not associated with it (VSrv internal error).
E2BIG The volume name was too big (greater than or equal to SIZE (1,024) characters.
VOLSERTRELE ERROR The trans transaction's reference count could not be dropped to the proper level. \subsection sec5-7-16 Section 5.7.16: AFSVolGetStatus - Get status of a
transaction/volume
int AFSVolGetStatus(IN struct rx connection *z conn,
IN long tid,
OUT struct volser status *status)
- Description
- This routine fills the status structure passed as a parameter with status information for the volume identified by the transaction identified by tid, if it exists. Included in this status information are the volume's ID, its type, disk quotas, the IDs of its clones and backup volumes, and several other administrative details.
- Error Codes
- ENOENT The tid transaction was not found.
VOLSERTRELE ERROR The tid transaction's reference count could not be dropped to the proper level. \subsection sec5-7-17 Section 5.7.17: AFSVolSetIdsTypes - Set header
info for a volume
int AFSVolSetIdsTypes(IN struct rx connection *z conn,
IN long tId
IN char *name,
IN long type,
IN long pId,
IN long cloneId,
IN long backupId)
- Description
- The transaction identifed by tId is located, and the values supplied for the volume name, volume type, parent ID pId, clone ID cloneId and backup ID backupId are recorded into the given transaction.
- Error Codes
- ENOENT The tId transaction was not found.
VOLSERBAD ACCESS The caller is not authorized to call this routine.
VOLSERBADNAME The volume name contained in name was longer than 31 characters plus the trailing null.
VOLSERTRELE ERROR The tId transaction's reference count could not be dropped to the proper level. \subsection sec5-7-18 Section 5.7.18: AFSVolSetDate - Set creation date
in a volume
int AFSVolSetDate(IN struct rx connection *z conn,
IN long tid,
IN long newDate)
- Description
- Set the creationDate of the struct volintInfo describing the volume associated with transaction tid to newDate.
- Error Codes
- VOLSERBAD ACCESS The caller is not authorized to call this routine.
ENOENT The tId transaction was not found.
VOLSERTRELE ERROR The tid transaction's reference count could not be dropped to the proper level. \subsection sec5-7-19 Section 5.7.19: AFSVolListPartitions - Return a
list of AFS partitions on a server
int AFSVolListPartitions(IN struct rx connection *z conn,
OUT struct pIDs *partIDs)
- Description
- Return a list of AFS partitions in use by the server processing this call. The output parameter is the fixed-length partIDs array, with one slot for each of 26 possible partitions. By convention, AFS partitions are named /vicepx, where x is any letter. The /vicepa partition is represented by a zero in this array, /vicepa bya1, andsoon. Unused partitions are represented by slots filled with a -1.
- Error Codes
- —None.
\subsection sec5-7-20 Section 5.7.20: AFSVolPartitionInfo - Get
partition information
int AFSVolPartitionInfo(IN struct rx connection *z conn,
IN char *name,
OUT struct diskPartition *partition)
- Description
- Collect information regarding the partition with the given character string name, and place it into the partition object provided.
- Error Codes
- VOLSERBAD ACCESS The caller is not authorized to call this routine.
VOLSERILLEGAL PARTITION An illegal partition was specified by name \subsection sec5-7-21 Section 5.7.21: AFSVolListVolumes - Return a list
of volumes on the server
int AFSVolListVolumes(IN struct rx connection *z conn,
IN long partID,
IN long flags,
OUT volEntries *resultEntries)
- Description
- Sweep through all the volumes on the partition identified by partid, filling in consecutive records in the resultEntries object. If the flags parameter is set to a non-zero value, then full status information is gathered. Otherwise, just the volume ID field is written for each record. The fields for a volEntries object like the one pointed to by resultEntries are described in Section 5.4.6, which covers the struct volintInfo definition.
- Error Codes
- VOLSERILLEGAL PARTITION An illegal partition was specified by partID
VOLSERNO MEMORY Not enough memory was available to hold all the required entries within resultEntries. \subsection sec5-7-22 Section 5.7.22: AFSVolListOneVolume - Return
header info for a single volume
int AFSVolListOneVolume(IN struct rx connection *z conn,
IN long partID,
IN long volid,
OUT volEntries *resultEntries)
- Description
- Find the information for the volume living on partition partID whose ID is volid, and place a single struct volintInfo entry within the variable-size resultEntries object.
- This is similar to the AFSVolListVolumes() call, which returns information on all volumes on the specified partition. The full volume information is always written into the returned entry (equivalent to setting the flags argument to AFSVolListVolumes() to a non-zero value).
- Error Codes
- VOLSERILLEGAL PARTITION An illegal partition was specified by partID
ENODEV The given volume was not found on the given partition. \subsection sec5-7.23 Section 5.7.23: AFSVolGetNthVolume - Get volume
header given its index
int AFSVolGetNthVolume(IN struct rx connection *z conn,
IN long index,
OUT long *volume,
OUT long *partition)
- Description
- Using index as a zero-based index into the set of volumes hosted by the server chosen by the z conn argument, return the volume ID and partition of residence for the given index. \Note This functionality has not yet been implemented.
- Error Codes
- VOLSERNO OP Not implemented.
\subsection sec5-7.24 Section 5.7.24: AFSVolMonitor - Collect server
transaction state
int AFSVolMonitor(IN struct rx connection *z conn,
OUT transDebugEntries *result)
- Description
- This call allows the transaction state of a Volume Server to be monitored for debugging purposes. Anyone wishing to supervise this Volume Server state may call this routine, causing all active transactions to be recorded in the given result object.
- Error Codes
- —None.
\page biblio Bibliography
- [1] Transarc Corporation. AFS 3.0 System Administrator's Guide, F-30-0-D102, Pittsburgh, PA, April 1990.
- [2] Transarc Corporation. AFS 3.0 Command Reference Manual, F-30-0-D103, Pittsburgh, PA, April 1990.
- [3] CMU Information Technology Center. Synchronization and Caching Issues in the Andrew File System, USENIX Proceedings, Dallas, TX, Winter 1988.
- [4] Information Technology Center, Carnegie Mellon University. Ubik -A Library For Managing Ubiquitous Data, ITCID, Pittsburgh, PA, Month, 1988.
- [5] Information Technology Center, Carnegie Mellon University. Quorum Completion, ITCID, Pittsburgh, PA, Month, 1988.