Peer-to-peer NFS
From Linux NFS
Contents |
Implementation
NFSD
Register DS
- NFSD: Implement REGISTER_DS
- Creates a new pnfs_p2p_client structure to store arguments from REGISTER_DS (netid, ip address, mds identifier, stateid) and attaches this structure to the struct nfs4_client sending the request. Assumes REGISTER_DS_ALL.
Unregister DS
- NFSD: Implement UNREGISTER_DS
- Frees the pnfs_p2p_client structure created by REGISTER_DS.
- Layout get: [NFSD: Find p2p device addresses for layoutget] Use most of pnfsd_lexp_layout_get(), adding a new function call when the device ID is set. I also add on to filelayout_encode_layout() to add the mds identifier to the front of the returned filehandle. pnfs_p2p_find_deviceid() will search the files delegation list and return the first client found that isn't the client placing the LAYOUTGET call. I send the DSs clientid as the device id for GETDEVINFO.
- Get device info: [NFSD: Find device address of a p2p DS] Use most of pnfsd_lexp_get_device_info(), but have the p2p code fill out the daddr return value in the p2p case. I can easily translate between devid and clientid since they're the same value, and this allows me to look up the netid and ip address from the client structure.
- Put filehandle: [NFSD: Make putfh work with p2p filehandles] Assume that any filehandle of length 36 is a p2p filehandle and split out the mds identifier from the rest of the handle. Don't do any of the state checking normally associated with putfh to avoid a crash since the NFS client doesn't set up an exports structure.
- Read: [NFSD: Make putfh work with p2p filehandles] If the filehandle is a p2p handle, then call the NFS client's nfs_proxy_open() function to map the p2pfh into a fh recognized by the DS.
- Proxy open: [NFSD: Implement PROXY_OPEN] Generate a new stateid representing the proxy open using the new struct pnfs_p2p_po_stid to store relevant information. Verify the filehandle exists using fh_verify(), since the DS skipped this check during the PUTFH call.
- Expire clients: [NFSD: Clean up p2p clients when they expire] Free up a client's p2p state when it expires.
- Proxy revoke: [most of PROXY_REVOKE] I send PROXY_REVOKE to clients that have PROXY_OPEN-ed files when a p2pclient (not p2pds) is expired. I haven't figured out the right way to free up the p2p stateid during nfsd4_cb_proxy_revoke_release() yet, my attempts all seem to cause an oops.