/** * nfsd_open_local_fh - lookup a local filehandle @nfs_fh and map to nfsd_file * * @net: 'struct net' to get the proper nfsd_net required for LOCALIO access * @dom: 'struct auth_domain' required for LOCALIO access * @rpc_clnt: rpc_clnt that the client established * @cred: cred that the client established * @nfs_fh: filehandle to lookup * @pnf: place to find the nfsd_file, or store it if it was non-NULL * @fmode: fmode_t to use for open * * This function maps a local fh to a path on a local filesystem. * This is useful when the nfs client has the local server mounted - it can * avoid all the NFS overhead with reads, writes and commits. * * On successful return, returned nfsd_file will have its nf_net member * set. Caller (NFS client) is responsible for calling nfsd_net_put and * nfsd_file_put (via nfs_to_nfsd_file_put_local).
*/ staticstruct nfsd_file *
nfsd_open_local_fh(struct net *net, struct auth_domain *dom, struct rpc_clnt *rpc_clnt, conststruct cred *cred, conststruct nfs_fh *nfs_fh, struct nfsd_file __rcu **pnf, const fmode_t fmode)
{ int mayflags = NFSD_MAY_LOCALIO; struct svc_cred rq_cred; struct svc_fh fh; struct nfsd_file *localio;
__be32 beres;
if (nfs_fh->size > NFS4_FHSIZE) return ERR_PTR(-EINVAL);
if (!nfsd_net_try_get(net)) return ERR_PTR(-ENXIO);
rcu_read_lock();
localio = nfsd_file_get(rcu_dereference(*pnf));
rcu_read_unlock(); if (localio) return localio;
fh_put(&fh); if (rq_cred.cr_group_info)
put_group_info(rq_cred.cr_group_info);
if (!IS_ERR(localio)) { struct nfsd_file *new; if (!nfsd_net_try_get(net)) {
nfsd_file_put(localio);
nfsd_net_put(net); return ERR_PTR(-ENXIO);
}
nfsd_file_get(localio);
again: new = unrcu_pointer(cmpxchg(pnf, NULL, RCU_INITIALIZER(localio))); if (new) { /* Some other thread installed an nfsd_file */ if (nfsd_file_get(new) == NULL) goto again; /* * Drop the ref we were going to install (both file and * net) and the one we were going to return (only file).
*/
nfsd_file_put(localio);
nfsd_net_put(net);
nfsd_file_put(localio);
localio = new;
}
} else
nfsd_net_put(net);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.