1 6741 th199096 /* 2 6741 th199096 * CDDL HEADER START 3 6741 th199096 * 4 6741 th199096 * The contents of this file are subject to the terms of the 5 6741 th199096 * Common Development and Distribution License (the "License"). 6 6741 th199096 * You may not use this file except in compliance with the License. 7 6741 th199096 * 8 6741 th199096 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 6741 th199096 * or http://www.opensolaris.org/os/licensing. 10 6741 th199096 * See the License for the specific language governing permissions 11 6741 th199096 * and limitations under the License. 12 6741 th199096 * 13 6741 th199096 * When distributing Covered Code, include this CDDL HEADER in each 14 6741 th199096 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 6741 th199096 * If applicable, add the following below this CDDL HEADER, with the 16 6741 th199096 * fields enclosed by brackets "[]" replaced with your own identifying 17 6741 th199096 * information: Portions Copyright [yyyy] [name of copyright owner] 18 6741 th199096 * 19 6741 th199096 * CDDL HEADER END 20 6741 th199096 */ 21 6741 th199096 /* 22 8424 lisa * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23 6741 th199096 * Use is subject to license terms. 24 6741 th199096 */ 25 6741 th199096 26 8036 Thomas #if defined(USE_FOR_SNOOP) 27 8036 Thomas %#include "ds_nfs_com.h" 28 8036 Thomas %#include "ds_prot.h" 29 8036 Thomas #else 30 6741 th199096 #if defined(RPC_XDR) || defined(RPC_SVC) || defined(RPC_CLNT) 31 6741 th199096 %#include <nfs/ds.h> 32 8036 Thomas #endif 33 6741 th199096 #endif 34 6741 th199096 35 6741 th199096 %#include <nfs/nfs41_fhtype.h> 36 6741 th199096 37 6741 th199096 const NFS_FH4MAXDATA = 26; 38 6741 th199096 39 6741 th199096 %#include <nfs/ds_filehandle.h> 40 6741 th199096 41 6741 th199096 /* 42 6741 th199096 * Dot-x file for the data server control protocol. 43 6741 th199096 */ 44 6741 th199096 45 7739 jwahlig /* 46 7739 jwahlig * Control Protocol identifier 47 7739 jwahlig */ 48 6741 th199096 typedef uint64_t ds_id; 49 7739 jwahlig typedef uint64_t ds_verifier; 50 6741 th199096 51 6741 th199096 enum ds_status { 52 6741 th199096 DS_OK = 0, 53 7739 jwahlig DSERR_ACCESS, 54 7739 jwahlig DSERR_ATTR_NOTSUPP, 55 7739 jwahlig DSERR_BAD_COOKIE, 56 8424 lisa DSERR_BADHANDLE, 57 7739 jwahlig DSERR_BAD_MDSSID, 58 7739 jwahlig DSERR_BAD_STATEID, 59 7739 jwahlig DSERR_EXPIRED, 60 7739 jwahlig DSERR_FHEXPIRED, 61 7739 jwahlig DSERR_GRACE, 62 7739 jwahlig DSERR_INVAL, 63 8424 lisa DSERR_IO, 64 7739 jwahlig DSERR_NOENT, 65 8424 lisa DSERR_NOT_AUTH, 66 6741 th199096 DSERR_NOSPC, 67 7739 jwahlig DSERR_NOTSUPP, 68 7739 jwahlig DSERR_OLD_STATEID, 69 7739 jwahlig DSERR_PNFS_NO_LAYOUT, 70 7739 jwahlig DSERR_RESOURCE, 71 7739 jwahlig DSERR_SERVERFAULT, 72 6741 th199096 DSERR_STALE, 73 7739 jwahlig DSERR_STALE_CLIENTID, 74 7739 jwahlig DSERR_STALE_DSID, 75 7739 jwahlig DSERR_STALE_STATEID, 76 6741 th199096 DSERR_TOOSMALL, 77 6741 th199096 DSERR_WRONGSEC, 78 6741 th199096 DSERR_XDR, 79 6741 th199096 DSERR_ILLEGAL 80 6741 th199096 }; 81 6741 th199096 82 8036 Thomas /* 83 8036 Thomas * XXX: Note that the supported bits have yet to be defined 84 8036 Thomas * and the size field would of course correspond to the 85 8036 Thomas * file size. 86 8036 Thomas */ 87 6741 th199096 struct ds_attr { 88 7739 jwahlig int ds_attrmask; 89 7739 jwahlig uint64_t ds_size; 90 6741 th199096 }; 91 6741 th199096 92 6741 th199096 struct identity { 93 7739 jwahlig ds_verifier boot_verifier; 94 7739 jwahlig opaque instance<MAXPATHLEN>; 95 6741 th199096 }; 96 6741 th199096 97 6741 th199096 /* 98 7739 jwahlig * DS_EXIBI - Exchange Identity and Boot Instance 99 7739 jwahlig * 100 7739 jwahlig * ds_ident : An identiifier that the MDS can use to distinguish 101 6741 th199096 * between data-server instances. 102 6741 th199096 */ 103 6741 th199096 struct DS_EXIBIargs { 104 7739 jwahlig identity ds_ident; 105 6741 th199096 }; 106 6741 th199096 107 6741 th199096 /* 108 7739 jwahlig * ds_id : The 'short-hand' identifier for the DS (MDS assigned) 109 6741 th199096 * 110 7739 jwahlig * mds_id : The 'short-hand' identifer for the MDS 111 6741 th199096 * 112 7739 jwahlig * mds_boot_verifier: An identifier that the data-server can use to determine 113 7739 jwahlig * if an MDS has rebooted. 114 7739 jwahlig * 115 7739 jwahlig * mds_lease_period: A hint to the data-server on the lease period 116 7739 jwahlig * currently in effect at the MDS. 117 6741 th199096 */ 118 6741 th199096 struct DS_EXIBIresok { 119 7739 jwahlig ds_id ds_id; 120 7739 jwahlig ds_id mds_id; 121 7739 jwahlig ds_verifier mds_boot_verifier; 122 7739 jwahlig uint32_t mds_lease_period; 123 6741 th199096 }; 124 6741 th199096 125 6741 th199096 union DS_EXIBIres switch (ds_status status) { 126 6741 th199096 case DS_OK: 127 7739 jwahlig DS_EXIBIresok res_ok; 128 6741 th199096 default: 129 6741 th199096 void; 130 6741 th199096 }; 131 6741 th199096 132 6741 th199096 /* 133 6741 th199096 * DS_CHECKSTATEargs - 134 6741 th199096 * 135 6741 th199096 * The message from a DS that is asking for the presented file state 136 6741 th199096 * to be verified. 137 6741 th199096 * 138 7739 jwahlig * stateid: 139 7739 jwahlig * 140 7739 jwahlig * The stateid the client presented for the I/O. 141 7739 jwahlig * 142 6741 th199096 * fh: 143 6741 th199096 * 144 6741 th199096 * File handle that the DS received in the compound (via PUTFH) 145 6741 th199096 * from the client when the client performed I/O. 146 6741 th199096 * 147 6741 th199096 * co_owner: 148 6741 th199096 * 149 8431 Piyush * client owner (MUST be same as MDS client owner as per NFSv4.1) 150 8431 Piyush * 151 8431 Piyush * mode: READ or WRITE, needed for checking access mode. 152 6741 th199096 */ 153 6741 th199096 struct DS_CHECKSTATEargs { 154 7739 jwahlig stateid4 stateid; 155 7739 jwahlig nfs_fh4 fh; 156 8431 Piyush client_owner4 co_owner; 157 8431 Piyush int mode; 158 6741 th199096 }; 159 6741 th199096 160 6741 th199096 /* 161 7739 jwahlig * ds_filestate - 162 6741 th199096 * 163 6741 th199096 * The reply to the DS from MDS that confirms the 164 6741 th199096 * validity of the presented state. 165 6741 th199096 * 166 6741 th199096 * mds_clid: 167 6741 th199096 * 168 7739 jwahlig * The MDS client id that corresponds to the presented stateid. 169 6741 th199096 * 170 6741 th199096 * layout: 171 6741 th199096 * 172 6741 th199096 * The layout of the file. This allows the DS 173 6741 th199096 * to determine if the offset that the client is performing 174 6741 th199096 * I/O to is valid based on the layout. 175 6741 th199096 * 176 6741 th199096 * open_mode: 177 6741 th199096 * 178 6741 th199096 * The effective open mode for the object + clientid, based on the 179 6741 th199096 * mode open() mode and the export mode 180 6741 th199096 * 181 6741 th199096 */ 182 6741 th199096 struct ds_filestate { 183 6741 th199096 clientid4 mds_clid; 184 7739 jwahlig layout4 layout<>; 185 6741 th199096 int open_mode; 186 6741 th199096 }; 187 6741 th199096 188 6741 th199096 union DS_CHECKSTATEres switch (ds_status status) { 189 6741 th199096 case DS_OK: 190 6741 th199096 ds_filestate file_state; 191 6741 th199096 default: 192 6741 th199096 void; 193 6741 th199096 }; 194 6741 th199096 195 6741 th199096 /* 196 7739 jwahlig * DS_FMATPT - 197 7739 jwahlig * 198 7739 jwahlig * A control protocol message that is used to transport FMA 199 7739 jwahlig * telemetry data to MDS. 200 7739 jwahlig * 201 7739 jwahlig * This is a placeholder for a post pNFS/Basic putback. 202 7739 jwahlig */ 203 7739 jwahlig struct DS_FMATPTargs { 204 7739 jwahlig opaque fma_msg<>; 205 7739 jwahlig }; 206 7739 jwahlig 207 7739 jwahlig 208 7739 jwahlig struct DS_FMATPTres { 209 7739 jwahlig ds_status status; 210 7739 jwahlig }; 211 7739 jwahlig 212 7739 jwahlig /* 213 7739 jwahlig * DS_MAP_MDS_DATASET_ID 214 7739 jwahlig * 215 7739 jwahlig * For a given MDS Dataset ID at the MDS return the root path. 216 7739 jwahlig * 217 7739 jwahlig */ 218 7739 jwahlig struct DS_MAP_MDS_DATASET_IDargs { 219 7739 jwahlig mds_dataset_id mds_dataset_id; 220 7739 jwahlig }; 221 7739 jwahlig 222 7739 jwahlig struct DS_MAP_MDS_DATASET_IDresok { 223 7739 jwahlig ds_status status; 224 7739 jwahlig utf8string pathname; 225 7739 jwahlig }; 226 7739 jwahlig 227 7739 jwahlig union DS_MAP_MDS_DATASET_IDres switch (ds_status status) { 228 7739 jwahlig case DS_OK: 229 7739 jwahlig DS_MAP_MDS_DATASET_IDresok res_ok; 230 7739 jwahlig default: 231 7739 jwahlig void; 232 7739 jwahlig }; 233 7739 jwahlig 234 7739 jwahlig /* 235 7739 jwahlig * DS_MAP_MDSSID 236 7739 jwahlig * 237 7739 jwahlig * Return a mapping for a given MDS Storage ID. 238 7739 jwahlig */ 239 7739 jwahlig struct DS_MAP_MDSSIDargs { 240 7739 jwahlig mds_sid mma_sid; 241 7739 jwahlig }; 242 7739 jwahlig 243 7739 jwahlig enum storage_type { 244 7739 jwahlig ZFS = 1 245 7739 jwahlig }; 246 7739 jwahlig 247 7739 jwahlig union ds_guid switch (storage_type stor_type) { 248 7739 jwahlig case ZFS: 249 7739 jwahlig opaque zfsguid<>; 250 7739 jwahlig default: 251 7739 jwahlig void; 252 7739 jwahlig }; 253 7739 jwahlig 254 7739 jwahlig /* 255 7739 jwahlig * ds_guid_map - 256 7739 jwahlig * 257 7739 jwahlig * The mapping between the local data server guid value and the id-value 258 7739 jwahlig * assigned by the MDS for mapping. 259 7739 jwahlig * 260 7739 jwahlig * If the storage type is ZFS, encoded in the ds_guid will be 261 7739 jwahlig * a ds_zfsguid. Other storage types may have their own guid 262 7739 jwahlig * definition. 263 7739 jwahlig * 264 7739 jwahlig * Encoded in the mds_sid field will be an array of mds_sid_contents. 265 7739 jwahlig */ 266 7739 jwahlig struct ds_guid_map { 267 7739 jwahlig ds_guid ds_guid; 268 7739 jwahlig mds_sid mds_sid_array<>; 269 7739 jwahlig }; 270 7739 jwahlig 271 7739 jwahlig struct DS_MAP_MDSSIDresok { 272 7739 jwahlig ds_guid_map guid_map; 273 7739 jwahlig }; 274 7739 jwahlig 275 7739 jwahlig union DS_MAP_MDSSIDres switch (ds_status status) { 276 7739 jwahlig case DS_OK: 277 7739 jwahlig DS_MAP_MDSSIDresok res_ok; 278 7739 jwahlig default: 279 7739 jwahlig void; 280 7739 jwahlig }; 281 7739 jwahlig 282 7739 jwahlig /* 283 7739 jwahlig * DS_RENEW - 284 7739 jwahlig * 285 7739 jwahlig * A message from the DS to MDS used to exchnage 286 7739 jwahlig * boot instances. This can be used to indicate to 287 7739 jwahlig * the MDS when a data server has rebooted, and 288 7739 jwahlig * also to the data-server when the MDS has rebooted. 289 7739 jwahlig * 290 7739 jwahlig * The data-server should drop all state when it 291 7739 jwahlig * detects that the MDS has rebooted. 292 7739 jwahlig * 293 7739 jwahlig * The MDS should drop any state that it believes 294 7739 jwahlig * the data-server is holding. 295 7739 jwahlig * 296 7739 jwahlig */ 297 7739 jwahlig struct DS_RENEWargs { 298 7739 jwahlig ds_id ds_id; 299 7739 jwahlig ds_verifier ds_boottime; 300 7739 jwahlig }; 301 7739 jwahlig 302 7739 jwahlig union DS_RENEWres switch (ds_status status) { 303 7739 jwahlig case DS_OK: 304 7739 jwahlig ds_verifier mds_boottime; 305 7739 jwahlig default: 306 7739 jwahlig void; 307 7739 jwahlig }; 308 7739 jwahlig 309 7739 jwahlig /* 310 7739 jwahlig * ds_zfsattr - 311 6741 th199096 * 312 6741 th199096 * Attribute that pertains to the zfs storage information/state etc. 313 6741 th199096 * 314 6741 th199096 * attrname: 315 6741 th199096 * 316 6741 th199096 * Name of attribute. 317 6741 th199096 * 318 6741 th199096 * attrvalue: 319 6741 th199096 * 320 6741 th199096 * Value of the attribute. 321 6741 th199096 * 322 6741 th199096 * Supported attributes: 323 6741 th199096 * 324 6741 th199096 * 325 6741 th199096 * +----------+------------+----------------------------------------- 326 6741 th199096 * | attrname | type | Description 327 6741 th199096 * +----------+------------+----------------------------------------- 328 6741 th199096 * | state | boolean | current status of pool: 0=offline, 329 6741 th199096 * | | | 1=online 330 6741 th199096 * +----------+------------+----------------------------------------- 331 6741 th199096 * | size | uint64_t | bytes free on dataset. 332 6741 th199096 * +----------+------------+----------------------------------------- 333 6741 th199096 * | config | attrvalue: xxx - look at how zpool status 334 6741 th199096 * | | displays the pool 335 6741 th199096 * | | configuration. 336 8168 Thomas * +----------+------------+----------------------------------------- 337 8168 Thomas * | dataset | utf8string | hostname:root_pool/root_data_set 338 6741 th199096 * +----------+------------+----------------------------------------- 339 6741 th199096 */ 340 6741 th199096 struct ds_zfsattr { 341 6741 th199096 utf8string attrname; 342 6741 th199096 opaque attrvalue<>; 343 6741 th199096 }; 344 6741 th199096 345 6741 th199096 typedef uint32_t ds_addruse; 346 6741 th199096 347 6741 th199096 /* 348 6741 th199096 * Intended usage for the addresses. 349 6741 th199096 */ 350 6741 th199096 const NFS = 0x00000001; 351 6741 th199096 const DSERV = 0x00000002; 352 6741 th199096 353 6741 th199096 /* 354 7739 jwahlig * ds_addr - 355 6741 th199096 * 356 6741 th199096 * A structure that is used to specify an address and 357 6741 th199096 * its usage. 358 6741 th199096 * 359 6741 th199096 * addr: 360 6741 th199096 * 361 6741 th199096 * The specific address on the DS. 362 6741 th199096 * 363 6741 th199096 * validuse: 364 6741 th199096 * 365 6741 th199096 * Bitmap associating the netaddr defined in "addr" 366 6741 th199096 * to the protocols that are valid for that interface. 367 6741 th199096 */ 368 6741 th199096 struct ds_addr { 369 8036 Thomas netaddr4 addr; 370 8036 Thomas ds_addruse validuse; 371 6741 th199096 }; 372 6741 th199096 373 6741 th199096 /* 374 6741 th199096 * ds_zfsguid - 375 6741 th199096 * 376 6741 th199096 * The data server guid made up of the local zpool guid + dataset id 377 6741 th199096 */ 378 6741 th199096 struct ds_zfsguid { 379 6741 th199096 uint64_t zpool_guid; 380 6741 th199096 uint64_t dataset_guid; 381 6741 th199096 }; 382 6741 th199096 383 6741 th199096 /* 384 6741 th199096 * ds_zfsinfo - 385 6741 th199096 * 386 6741 th199096 * Contains all the attributes that pertain to the specified ZFS storage 387 6741 th199096 * identifier. 388 6741 th199096 * 389 6741 th199096 * guid_map: 390 6741 th199096 * 391 6741 th199096 * Unique value identifying the pNFS dataset and the zpool it lives in. 392 6741 th199096 * *Note: This has to be unique across all storage in our 393 6741 th199096 * system. Meaning that we may have to generate ids 394 6741 th199096 * which take into account the poolid assigned by the SPA 395 6741 th199096 * and the DS that the pool belongs to. 396 6741 th199096 * 397 6741 th199096 * attrs: 398 6741 th199096 * 399 6741 th199096 * List of name value pairs corresponding to the attributes 400 6741 th199096 * of the ZFS data store (e.g. zpool and dataset attribues). 401 6741 th199096 * *Note: We may want to rethink how we are handling attributes. 402 6741 th199096 * We should probably have some general attributes (e.g. 403 6741 th199096 * online/offline, size, free_size). Then we can have 404 6741 th199096 * attributes that are specific to the storage type (e.g. 405 6741 th199096 * zpool configuration (e.g. mirrored, RAIDZ), 406 6741 th199096 * dataset attributes (e.g. encryption, compression). 407 6741 th199096 */ 408 6741 th199096 struct ds_zfsinfo { 409 6741 th199096 ds_guid_map guid_map; 410 6741 th199096 ds_zfsattr attrs<>; 411 6741 th199096 }; 412 6741 th199096 413 6741 th199096 /* 414 6741 th199096 * ds_storinfo - 415 6741 th199096 * 416 6741 th199096 * Information about the storage available to the data server. 417 6741 th199096 * Currently, the only storage type is ZFS, but there may be others 418 6741 th199096 * in the future. 419 6741 th199096 */ 420 6741 th199096 union ds_storinfo switch (storage_type type) { 421 6741 th199096 case ZFS: 422 6741 th199096 ds_zfsinfo zfs_info; 423 6741 th199096 default: 424 6741 th199096 void; 425 6741 th199096 }; 426 6741 th199096 427 6741 th199096 enum ds_attr_version { 428 6741 th199096 DS_ATTR_v1 = 1 429 6741 th199096 }; 430 6741 th199096 431 6741 th199096 /* 432 6741 th199096 * DS_REPORTAVAILargs - 433 6741 th199096 * 434 6741 th199096 * A message to the MDS from a DS to provide availability 435 6741 th199096 * information for storage pools and network interfaces. 436 6741 th199096 * 437 6741 th199096 * ds_id: 438 6741 th199096 * 439 6741 th199096 * The short-hand idenifier assigned by the MDS and returned 440 6741 th199096 * in the DS_EXIBI reply. 441 6741 th199096 * 442 6741 th199096 * ds_addrs: 443 6741 th199096 * 444 6741 th199096 * An array of DS_addr associated with DS and information 445 6741 th199096 * about the intended use of each address; Specified as 446 6741 th199096 * an array since it is possible for a DS to have multiple 447 6741 th199096 * interfaces available. 448 6741 th199096 * 449 6741 th199096 * ds_attrvers: 450 6741 th199096 * 451 6741 th199096 * Version indicating the set of attributes that the data server is 452 6741 th199096 * aware of/supports. (XXX - This may change to a supported attrs bitmask). 453 6741 th199096 * 454 6741 th199096 * ds_storinfo: 455 6741 th199096 * 456 6741 th199096 * Array of storage information. For each piece of storage there will 457 6741 th199096 * be one entry in this array. 458 6741 th199096 */ 459 6741 th199096 struct DS_REPORTAVAILargs { 460 7739 jwahlig ds_id ds_id; 461 7739 jwahlig ds_verifier ds_verifier; 462 7739 jwahlig struct ds_addr ds_addrs<>; 463 7739 jwahlig ds_attr_version ds_attrvers; 464 7739 jwahlig ds_storinfo ds_storinfo<>; 465 6741 th199096 }; 466 6741 th199096 467 6741 th199096 /* 468 6741 th199096 * DS_REPORTAVAILres_ok - 469 6741 th199096 * 470 6741 th199096 * Response from the MDS on a successful DS_REPORTAVAIL call. 471 6741 th199096 * 472 6741 th199096 * ds_attrvers: 473 6741 th199096 * 474 6741 th199096 * Version indicating the set of attributes that the metadata server is 475 6741 th199096 * aware of/supports. (XXX - This may change to a supported attrs bitmask). 476 6741 th199096 * 477 6741 th199096 * guid_map: 478 6741 th199096 * 479 7739 jwahlig * Map of data server guids to Metadata Server Storage IDs (MDS SIDs) 480 6741 th199096 */ 481 7739 jwahlig struct DS_REPORTAVAILresok { 482 6741 th199096 ds_attr_version ds_attrvers; 483 6741 th199096 ds_guid_map guid_map<>; 484 6741 th199096 }; 485 6741 th199096 486 6741 th199096 union DS_REPORTAVAILres switch (ds_status status) { 487 6741 th199096 case DS_OK: 488 7739 jwahlig DS_REPORTAVAILresok res_ok; 489 6741 th199096 default: 490 6741 th199096 void; 491 6741 th199096 }; 492 6741 th199096 493 6741 th199096 /* 494 6741 th199096 * DS_SECINFO - 495 6741 th199096 * 496 6741 th199096 * A message from the DS to MDS used to inquire 497 6741 th199096 * for the secrity flavors of an object. 498 6741 th199096 * 499 6741 th199096 */ 500 6741 th199096 struct DS_SECINFOargs { 501 8036 Thomas nfs_fh4 object; 502 8036 Thomas netaddr4 cl_addr; 503 6741 th199096 }; 504 6741 th199096 505 7739 jwahlig /* RPCSEC_GSS has a value of '6' - See RFC 2203 */ 506 6741 th199096 union ds_secinfo switch (uint32_t flavor) { 507 7739 jwahlig case RPCSEC_GSS: 508 7739 jwahlig rpcsec_gss_info flavor_info; 509 7739 jwahlig default: 510 7739 jwahlig void; 511 6741 th199096 }; 512 6741 th199096 513 6741 th199096 typedef ds_secinfo DS_SECINFOresok<>; 514 6741 th199096 515 6741 th199096 union DS_SECINFOres switch (ds_status status) { 516 6741 th199096 case DS_OK: 517 7739 jwahlig DS_SECINFOresok res_ok; 518 6741 th199096 default: 519 6741 th199096 void; 520 6741 th199096 }; 521 6741 th199096 522 6741 th199096 /* 523 8036 Thomas * DS_SHUTDOWN - 524 6741 th199096 * 525 6741 th199096 * A notification to the MDS that this Data Server has/is in 526 6741 th199096 * the process of a graceful shutdown. 527 6741 th199096 * 528 6741 th199096 */ 529 6741 th199096 struct DS_SHUTDOWNargs { 530 6741 th199096 ds_id ds_id; 531 6741 th199096 }; 532 6741 th199096 533 6741 th199096 534 6741 th199096 struct DS_SHUTDOWNres { 535 6741 th199096 ds_status status; 536 6741 th199096 }; 537 6741 th199096 538 6741 th199096 program PNFSCTLDS { 539 6741 th199096 version PNFSCTLDS_V1 { 540 6741 th199096 void 541 6741 th199096 DSPROC_NULL(void) = 0; 542 6741 th199096 543 7739 jwahlig DS_CHECKSTATEres 544 7739 jwahlig DS_CHECKSTATE(DS_CHECKSTATEargs) = 1; 545 7739 jwahlig 546 6741 th199096 DS_EXIBIres 547 7739 jwahlig DS_EXIBI(DS_EXIBIargs) = 2; 548 6741 th199096 549 7739 jwahlig DS_FMATPTres 550 7739 jwahlig DS_FMATPT(DS_FMATPTargs) = 3; 551 7739 jwahlig 552 7739 jwahlig DS_MAP_MDS_DATASET_IDres 553 7739 jwahlig DS_MAP_MDS_DATASET_ID(DS_MAP_MDS_DATASET_IDargs) = 4; 554 7739 jwahlig 555 7739 jwahlig DS_MAP_MDSSIDres 556 7739 jwahlig DS_MAP_MDSSID(DS_MAP_MDSSIDargs) = 5; 557 6741 th199096 558 6741 th199096 DS_RENEWres 559 7739 jwahlig DS_RENEW(DS_RENEWargs) = 6; 560 6741 th199096 561 6741 th199096 DS_REPORTAVAILres 562 7739 jwahlig DS_REPORTAVAIL(DS_REPORTAVAILargs) = 7; 563 6741 th199096 564 6741 th199096 DS_SECINFOres 565 7739 jwahlig DS_SECINFO(DS_SECINFOargs) = 8; 566 6741 th199096 567 6741 th199096 DS_SHUTDOWNres 568 7739 jwahlig DS_SHUTDOWN(DS_SHUTDOWNargs) = 9; 569 6741 th199096 } = 1; 570 6741 th199096 } = 104001; 571 6741 th199096 572 6741 th199096 573 6741 th199096 /* 574 6741 th199096 * NFS MDS Control Protocol: 575 6741 th199096 * 576 6741 th199096 * Traffic flows from the MDS to the data-server 577 6741 th199096 */ 578 6741 th199096 579 6741 th199096 struct ds_filesegbuf { 580 6741 th199096 offset4 offset; 581 6741 th199096 opaque data<>; 582 6741 th199096 }; 583 6741 th199096 584 6741 th199096 struct ds_fileseg { 585 6741 th199096 offset4 offset; 586 6741 th199096 count4 count; 587 6741 th199096 }; 588 6741 th199096 589 6741 th199096 590 6741 th199096 /* 591 6741 th199096 * DS_COMMIT: 592 6741 th199096 * 593 6741 th199096 * Commit a range written to a data-server. 594 6741 th199096 * 595 6741 th199096 */ 596 6741 th199096 struct DS_COMMITargs { 597 6741 th199096 nfs_fh4 fh; 598 6741 th199096 ds_fileseg cmv<>; 599 6741 th199096 }; 600 6741 th199096 601 6741 th199096 struct DS_COMMITresok { 602 7739 jwahlig ds_verifier writeverf; 603 6741 th199096 count4 count<>; 604 6741 th199096 }; 605 6741 th199096 606 6741 th199096 union DS_COMMITres switch (ds_status status) { 607 6741 th199096 case DS_OK: 608 7739 jwahlig DS_COMMITresok res_ok; 609 6741 th199096 default: 610 6741 th199096 void; 611 6741 th199096 }; 612 6741 th199096 613 6741 th199096 /* 614 6741 th199096 * DS_GETATTR: 615 6741 th199096 * 616 6741 th199096 * Query data-server for attributes for the specified object. 617 6741 th199096 * 618 6741 th199096 * fh: 619 6741 th199096 * 620 6741 th199096 * The file handle for the object for which the DS 621 6741 th199096 * is to give attributes for. 622 6741 th199096 * 623 6741 th199096 * dattr: 624 6741 th199096 * 625 6741 th199096 * Bitmap of attributes. 626 6741 th199096 */ 627 6741 th199096 struct DS_GETATTRargs { 628 6741 th199096 nfs_fh4 fh; 629 6741 th199096 ds_attr dattrs; 630 6741 th199096 }; 631 6741 th199096 632 6741 th199096 union DS_GETATTRres switch (ds_status status) { 633 6741 th199096 case DS_OK: 634 6741 th199096 ds_attr dattrs; 635 6741 th199096 default: 636 6741 th199096 void; 637 6741 th199096 }; 638 6741 th199096 639 6741 th199096 /* 640 7739 jwahlig * DS_INVALIDATE: 641 6741 th199096 * 642 7739 jwahlig * Invalidate state at the data-server. 643 6741 th199096 * 644 7739 jwahlig * The scope of invalidation is dependent on object type. 645 6741 th199096 * 646 7739 jwahlig * type: 647 6741 th199096 * 648 7739 jwahlig * represents the type (and by virtue scope) of state invalidation 649 7739 jwahlig * that should occur at the DS. 650 6741 th199096 * 651 8424 lisa * Examples of when the different invalidate types will be used are as follows: 652 8424 lisa * DS_INVALIDATE_ALL - Used on nfs/server service offlined on the MDS 653 8424 lisa * DS_INVALIDATE_CLIENTID - Used on client lease (with the MDS) expiration 654 8424 lisa * DS_INVALIDATE_LAYOUT_BY_CLIENT - Used on LAYOUTRETURN when 655 8424 lisa * invalidating all layouts held by a client 656 8424 lisa * DS_INVALIDATE_LAYOUT_BY_FH - Used on REMOVE issued from client to MDS 657 8424 lisa * DS_INVALIDATE_LAYOUT_BY_STATEID - Used on LAYOUTRETURN when 658 8424 lisa * invalidating a specific layout held by a client 659 8424 lisa * DS_INVALIDATE_MDS_DATASET_ID - Used on unshare of MDS FS 660 8424 lisa * DS_INVALIDATE_STATEID - Used on CLOSE, UNLOCK, DELEGRETURN issued from 661 8424 lisa * client to MDS 662 6741 th199096 */ 663 7739 jwahlig enum ds_invalidate_type { 664 7739 jwahlig DS_INVALIDATE_ALL, 665 8424 lisa DS_INVALIDATE_CLIENTID, 666 8424 lisa DS_INVALIDATE_LAYOUT_BY_CLIENT, 667 8424 lisa DS_INVALIDATE_LAYOUT_BY_FH, 668 8424 lisa DS_INVALIDATE_LAYOUT_BY_STATEID, 669 7739 jwahlig DS_INVALIDATE_MDS_DATASET_ID, 670 7739 jwahlig DS_INVALIDATE_STATEID 671 6741 th199096 }; 672 6741 th199096 673 8424 lisa struct ds_inval_layout_by_clid { 674 8424 lisa clientid4 mds_clid; 675 7739 jwahlig nfs_fh4 fh; 676 6741 th199096 }; 677 6741 th199096 678 8424 lisa struct ds_inval_layout_by_lo_stateid { 679 8424 lisa stateid4 layout_stateid; /* MUST be layout stateid */ 680 8424 lisa nfs_fh4 fh; 681 8424 lisa }; 682 8424 lisa 683 8424 lisa struct ds_inval_stateid { 684 8424 lisa stateid4 stateid; /* MUST be open, lock or delegation stateid */ 685 7739 jwahlig nfs_fh4 fh; 686 6741 th199096 }; 687 6741 th199096 688 7739 jwahlig union DS_INVALIDATEargs switch (ds_invalidate_type obj) { 689 6741 th199096 690 8424 lisa case DS_INVALIDATE_ALL: 691 8424 lisa void; 692 8424 lisa 693 8424 lisa case DS_INVALIDATE_CLIENTID: 694 8424 lisa clientid4 clid; 695 8424 lisa 696 8424 lisa case DS_INVALIDATE_LAYOUT_BY_CLIENT: 697 8424 lisa ds_inval_layout_by_clid layout; 698 8424 lisa 699 8424 lisa case DS_INVALIDATE_LAYOUT_BY_FH: 700 8424 lisa nfs_fh4 fh; 701 8424 lisa 702 8424 lisa case DS_INVALIDATE_LAYOUT_BY_STATEID: 703 8424 lisa ds_inval_layout_by_lo_stateid lo_stateid; 704 7739 jwahlig 705 7739 jwahlig case DS_INVALIDATE_MDS_DATASET_ID: 706 7739 jwahlig mds_dataset_id dataset_id; 707 7739 jwahlig 708 7739 jwahlig case DS_INVALIDATE_STATEID: 709 7739 jwahlig ds_inval_stateid stateid; 710 7739 jwahlig }; 711 7739 jwahlig 712 7739 jwahlig struct DS_INVALIDATEres { 713 7739 jwahlig ds_status status; 714 6741 th199096 }; 715 6741 th199096 716 6741 th199096 /* 717 6741 th199096 * DS_LIST: 718 6741 th199096 * 719 6741 th199096 * Get a list of objects from the data-server matching provided 720 7739 jwahlig * criteria. (either mds_dataset_id or mds_sid) 721 6741 th199096 */ 722 6741 th199096 enum ds_list_type { 723 7739 jwahlig DS_LIST_MDS_SID, 724 7739 jwahlig DS_LIST_MDS_DATASET_ID 725 6741 th199096 }; 726 6741 th199096 727 7739 jwahlig struct ds_list_sid_arg { 728 7739 jwahlig mds_sid mds_sid; 729 6741 th199096 uint64_t cookie; 730 6741 th199096 count4 maxcount; 731 6741 th199096 }; 732 6741 th199096 733 7739 jwahlig struct ds_list_dataset_arg { 734 7739 jwahlig mds_dataset_id dataset_id; 735 6741 th199096 uint64_t cookie; 736 6741 th199096 count4 maxcount; 737 6741 th199096 }; 738 6741 th199096 739 7739 jwahlig union DS_LISTargs switch (ds_list_type dla_type) { 740 7739 jwahlig case DS_LIST_MDS_SID: 741 7739 jwahlig ds_list_sid_arg sid; 742 6741 th199096 743 7739 jwahlig case DS_LIST_MDS_DATASET_ID: 744 7739 jwahlig ds_list_dataset_arg dataset_id; 745 6741 th199096 746 6741 th199096 default: 747 6741 th199096 void; 748 6741 th199096 }; 749 6741 th199096 750 7739 jwahlig struct DS_LISTresok { 751 7739 jwahlig nfs_fh4 fh_list<>; 752 7739 jwahlig uint64_t cookie; 753 6741 th199096 }; 754 6741 th199096 755 8036 Thomas union DS_LISTres switch (ds_status status) { 756 7739 jwahlig case DS_OK: 757 7739 jwahlig DS_LISTresok res_ok; 758 7739 jwahlig default: 759 7739 jwahlig void; 760 7739 jwahlig }; 761 7739 jwahlig 762 7739 jwahlig /* 763 7739 jwahlig * MDS to DS - Data movement initiation messages 764 7739 jwahlig */ 765 7739 jwahlig struct DS_OBJ_MOVEargs { 766 7739 jwahlig uint64_t taskid; 767 7739 jwahlig nfs_fh4 source; 768 7739 jwahlig nfs_fh4 target; 769 8036 Thomas netaddr4 targetserver; 770 7739 jwahlig }; 771 7739 jwahlig 772 7739 jwahlig struct DS_OBJ_MOVEres { 773 8036 Thomas ds_status status; 774 7739 jwahlig }; 775 7739 jwahlig 776 7739 jwahlig struct DS_OBJ_MOVE_STATUSargs { 777 7739 jwahlig uint64_t taskid; 778 7739 jwahlig }; 779 7739 jwahlig 780 7739 jwahlig struct DS_OBJ_MOVE_STATUSresok { 781 7739 jwahlig uint64_t maxoffset; 782 7739 jwahlig bool complete; 783 7739 jwahlig }; 784 7739 jwahlig 785 7739 jwahlig union DS_OBJ_MOVE_STATUSres switch (ds_status status) { 786 7739 jwahlig case DS_OK: 787 7739 jwahlig DS_OBJ_MOVE_STATUSresok res_ok; 788 7739 jwahlig default: 789 7739 jwahlig void; 790 7739 jwahlig }; 791 7739 jwahlig 792 7739 jwahlig struct DS_OBJ_MOVE_ABORTargs { 793 7739 jwahlig uint64_t taskid; 794 7739 jwahlig }; 795 7739 jwahlig 796 7739 jwahlig struct DS_OBJ_MOVE_ABORTres { 797 8036 Thomas ds_status status; 798 6741 th199096 }; 799 6741 th199096 800 6741 th199096 /* 801 6741 th199096 * DS_PNFSSTAT 802 6741 th199096 * 803 6741 th199096 * Return the kstat counters. 804 6741 th199096 * 805 6741 th199096 */ 806 6741 th199096 807 6741 th199096 /* RPC kstats */ 808 6741 th199096 const DS_NFSSTAT_RPC = 0x000000001; 809 6741 th199096 810 6741 th199096 /* NFS kstats */ 811 6741 th199096 const DS_NFSSTAT_NFS = 0x000000002; 812 6741 th199096 813 6741 th199096 /* the DMOV protocol kstats */ 814 6741 th199096 const DS_NFSSTAT_DMOV = 0x000000004; 815 6741 th199096 816 6741 th199096 /* the control protocol kstats */ 817 6741 th199096 const DS_NFSSTAT_CP = 0x000000008; 818 6741 th199096 819 6741 th199096 /* CPU kstat (all stats for module cpu)*/ 820 6741 th199096 const DS_NFSSTAT_CPU = 0x000000010; 821 6741 th199096 822 6741 th199096 /* 823 6741 th199096 * More anticipated ... 824 6741 th199096 */ 825 6741 th199096 struct DS_PNFSSTATargs { 826 7739 jwahlig uint64_t stat_wanted; 827 6741 th199096 }; 828 6741 th199096 829 7739 jwahlig struct DS_PNFSSTATresok { 830 7739 jwahlig opaque nvlist<>; 831 7739 jwahlig }; 832 6741 th199096 833 7739 jwahlig union DS_PNFSSTATres switch (ds_status status) { 834 7739 jwahlig case DS_OK: 835 7739 jwahlig DS_PNFSSTATresok res_ok; 836 7739 jwahlig default: 837 7739 jwahlig void; 838 7739 jwahlig }; 839 7739 jwahlig 840 7739 jwahlig /* 841 7739 jwahlig * DS_READ: 842 7739 jwahlig * 843 7739 jwahlig * Read a range of bytes from a data-server 844 7739 jwahlig */ 845 7739 jwahlig struct DS_READargs { 846 7739 jwahlig nfs_fh4 fh; 847 7739 jwahlig count4 count; 848 7739 jwahlig ds_fileseg rdv<>; 849 7739 jwahlig }; 850 7739 jwahlig 851 7739 jwahlig struct DS_READresok { 852 7739 jwahlig bool eof; 853 7739 jwahlig count4 count; 854 7739 jwahlig ds_filesegbuf rdv<>; 855 7739 jwahlig }; 856 7739 jwahlig 857 7739 jwahlig union DS_READres switch (ds_status status) { 858 7739 jwahlig case DS_OK: 859 7739 jwahlig DS_READresok res_ok; 860 7739 jwahlig default: 861 7739 jwahlig void; 862 7739 jwahlig }; 863 7739 jwahlig 864 8424 lisa %/* 865 8424 lisa % * CTL_MDS_REMOVE: 866 8424 lisa % * 867 8424 lisa % * Sent from MDS to DS to remove object(s) or entire fsid at the data-server 868 8424 lisa % * 869 8424 lisa % */ 870 8424 lisa enum ctl_mds_rm_type { 871 8424 lisa CTL_MDS_RM_OBJ, 872 8424 lisa CTL_MDS_RM_MDS_DATASET_ID 873 7739 jwahlig }; 874 7739 jwahlig 875 8424 lisa struct ctl_mds_remove_mds_dataset_id { 876 8424 lisa mds_sid mds_sid; 877 8424 lisa mds_dataset_id dataset_id<>; 878 8424 lisa }; 879 8424 lisa 880 8424 lisa union CTL_MDS_REMOVEargs switch (ctl_mds_rm_type type) { 881 8424 lisa case CTL_MDS_RM_OBJ: 882 7739 jwahlig nfs_fh4 obj<>; 883 8424 lisa case CTL_MDS_RM_MDS_DATASET_ID: 884 8424 lisa ctl_mds_remove_mds_dataset_id dataset_info; 885 7739 jwahlig default: 886 7739 jwahlig void; 887 7739 jwahlig }; 888 7739 jwahlig 889 8424 lisa struct CTL_MDS_REMOVEres { 890 7739 jwahlig ds_status status; 891 7739 jwahlig }; 892 7739 jwahlig 893 7739 jwahlig /* 894 7739 jwahlig * DS_SETATTR: 895 7739 jwahlig * 896 7739 jwahlig * Set/Store attributes for the specified object 897 7739 jwahlig * at the data-server 898 7739 jwahlig * 899 7739 jwahlig * fh: 900 7739 jwahlig * 901 7739 jwahlig * The file handle for the object for which the DS 902 7739 jwahlig * is to set attributes for. 903 7739 jwahlig * 904 7739 jwahlig * dattrs: 905 7739 jwahlig * 906 7739 jwahlig * Bitmap of attributes. 907 7739 jwahlig */ 908 7739 jwahlig struct DS_SETATTRargs { 909 7739 jwahlig nfs_fh4 fh; 910 7739 jwahlig ds_attr dattrs; 911 7739 jwahlig }; 912 7739 jwahlig 913 7739 jwahlig struct DS_SETATTRres { 914 7739 jwahlig ds_status status; 915 7739 jwahlig }; 916 7739 jwahlig 917 7739 jwahlig /* 918 7739 jwahlig * DS_SNAP 919 7739 jwahlig * 920 7739 jwahlig * For a given MDS Dataset ID at the MDS, snapshot the data-set. 921 7739 jwahlig * 922 7739 jwahlig */ 923 7739 jwahlig struct DS_SNAPargs { 924 7739 jwahlig mds_dataset_id dataset_id; 925 7739 jwahlig }; 926 7739 jwahlig 927 7739 jwahlig struct DS_SNAPresok { 928 7739 jwahlig utf8string name; 929 7739 jwahlig }; 930 7739 jwahlig 931 7739 jwahlig union DS_SNAPres switch (ds_status status) { 932 7739 jwahlig case DS_OK: 933 7739 jwahlig DS_SNAPresok res_ok; 934 7739 jwahlig default: 935 7739 jwahlig void; 936 7739 jwahlig }; 937 7739 jwahlig 938 7739 jwahlig /* 939 7739 jwahlig * DS_STAT: 940 7739 jwahlig * 941 7739 jwahlig * Collect statistics for the status of an object, 942 7739 jwahlig * like size etc.. 943 7739 jwahlig * 944 7739 jwahlig */ 945 7739 jwahlig struct DS_STATargs { 946 7739 jwahlig nfs_fh4 object; 947 7739 jwahlig }; 948 7739 jwahlig 949 7739 jwahlig 950 7739 jwahlig union DS_STATres switch (ds_status status) { 951 7739 jwahlig case DS_OK: 952 7739 jwahlig ds_attr dattr; 953 7739 jwahlig default: 954 7739 jwahlig void; 955 7739 jwahlig }; 956 7739 jwahlig 957 7739 jwahlig /* 958 7739 jwahlig * DS_WRITE: 959 7739 jwahlig * 960 7739 jwahlig * Write a range of bytes to a data-server 961 7739 jwahlig * 962 7739 jwahlig */ 963 7739 jwahlig struct DS_WRITEargs { 964 7739 jwahlig nfs_fh4 fh; 965 7739 jwahlig stable_how4 stable; 966 7739 jwahlig count4 count; 967 7739 jwahlig ds_filesegbuf wrv<>; 968 7739 jwahlig }; 969 7739 jwahlig 970 7739 jwahlig struct DS_WRITEresok { 971 7739 jwahlig stable_how4 committed; 972 7739 jwahlig ds_verifier writeverf; 973 7739 jwahlig count4 wrv<>; 974 7739 jwahlig }; 975 7739 jwahlig 976 7739 jwahlig union DS_WRITEres switch (ds_status status) { 977 7739 jwahlig case DS_OK: 978 7739 jwahlig DS_WRITEresok res_ok; 979 7739 jwahlig default: 980 7739 jwahlig void; 981 6741 th199096 }; 982 6741 th199096 983 8424 lisa %/* 984 8424 lisa % * The PNFS_CTL_MDS RPC program defines the control protocol messages that 985 8424 lisa % * are sent from the MDS to the DS. 986 8424 lisa % */ 987 8424 lisa program PNFS_CTL_MDS { 988 8424 lisa version PNFS_CTL_MDS_V1 { 989 6741 th199096 990 6741 th199096 void 991 6741 th199096 DSPROC_NULL(void) = 0; 992 6741 th199096 993 6741 th199096 DS_COMMITres 994 6741 th199096 DS_COMMIT(DS_COMMITargs) = 1; 995 6741 th199096 996 6741 th199096 DS_GETATTRres 997 6741 th199096 DS_GETATTR(DS_GETATTRargs) = 2; 998 6741 th199096 999 7739 jwahlig DS_INVALIDATEres 1000 7739 jwahlig DS_INVALIDATE(DS_INVALIDATEargs) = 3; 1001 7739 jwahlig 1002 7739 jwahlig DS_LISTres 1003 7739 jwahlig DS_LIST(DS_LISTargs) = 4; 1004 7739 jwahlig 1005 7739 jwahlig DS_OBJ_MOVEres 1006 7739 jwahlig DS_OBJ_MOVE(DS_OBJ_MOVEargs) = 5; 1007 7739 jwahlig 1008 7739 jwahlig DS_OBJ_MOVE_ABORTres 1009 7739 jwahlig DS_OBJ_MOVE_ABORT(DS_OBJ_MOVE_ABORTargs) = 6; 1010 7739 jwahlig 1011 7739 jwahlig DS_OBJ_MOVE_STATUSres 1012 7739 jwahlig DS_OBJ_MOVE_STATUS(DS_OBJ_MOVE_STATUSargs) = 7; 1013 7739 jwahlig 1014 7739 jwahlig DS_PNFSSTATres 1015 7739 jwahlig DS_PNFSSTAT(DS_PNFSSTATargs) = 8; 1016 6741 th199096 1017 6741 th199096 DS_READres 1018 7739 jwahlig DS_READ(DS_READargs) = 9; 1019 6741 th199096 1020 8424 lisa CTL_MDS_REMOVEres 1021 8424 lisa CTL_MDS_REMOVE(CTL_MDS_REMOVEargs) = 10; 1022 7739 jwahlig 1023 7739 jwahlig DS_SETATTRres 1024 7739 jwahlig DS_SETATTR(DS_SETATTRargs) = 11; 1025 7739 jwahlig 1026 7739 jwahlig DS_STATres 1027 7739 jwahlig DS_STAT(DS_STATargs) = 12; 1028 7739 jwahlig 1029 7739 jwahlig DS_SNAPres 1030 7739 jwahlig DS_SNAP(DS_SNAPargs) = 13; 1031 6741 th199096 1032 6741 th199096 DS_WRITEres 1033 7739 jwahlig DS_WRITE(DS_WRITEargs) = 14; 1034 6741 th199096 1035 6741 th199096 } = 1; 1036 6741 th199096 } = 104000; 1037 6741 th199096 1038 7739 jwahlig /* 1039 7739 jwahlig * DS to DS data movement protocol. 1040 7739 jwahlig */ 1041 6741 th199096 1042 7739 jwahlig struct MOVEargs { 1043 7739 jwahlig uint64_t taskid; 1044 7739 jwahlig uint64_t minoffset; 1045 7739 jwahlig uint64_t maxoffset; 1046 7739 jwahlig uint32_t maxbytes; 1047 6741 th199096 }; 1048 6741 th199096 1049 7739 jwahlig struct MOVEsegment { 1050 7739 jwahlig uint64_t fileoffset; 1051 7739 jwahlig uint32_t len; 1052 6741 th199096 }; 1053 6741 th199096 1054 7739 jwahlig struct MOVEresok { 1055 7739 jwahlig opaque data<>; 1056 7739 jwahlig struct MOVEsegment segments<>; 1057 6741 th199096 }; 1058 6741 th199096 1059 7739 jwahlig union MOVEres switch (ds_status status) { 1060 7739 jwahlig case DS_OK: 1061 7739 jwahlig MOVEresok res_ok; 1062 7739 jwahlig default: 1063 7739 jwahlig void; 1064 6741 th199096 }; 1065 6741 th199096 1066 6741 th199096 program PNFSCTLMV { 1067 6741 th199096 version PNFSCTLMV_V1 { 1068 6741 th199096 void 1069 6741 th199096 DSPROC_NULL(void) = 0; 1070 6741 th199096 1071 7739 jwahlig MOVEres 1072 7739 jwahlig MOVE(MOVEargs) = 1; 1073 6741 th199096 } = 1; 1074 6741 th199096 } = 104002; 1075