clp->cl_nconnect = cl_init->nconnect;
clp->cl_max_connect = cl_init->max_connect ? cl_init->max_connect : 1;
clp->cl_net = get_net_track(cl_init->net, &clp->cl_ns_tracker, GFP_KERNEL);
+ if (cl_init->clientid) {
+ err = -ENOMEM;
+ clp->clientid = kstrdup(cl_init->clientid, GFP_KERNEL);
+ if (!clp->clientid)
+ goto error_free_host;
+ }
#if IS_ENABLED(CONFIG_NFS_LOCALIO)
seqlock_init(&clp->cl_boot_lock);
clp->cl_xprtsec = cl_init->xprtsec;
return clp;
+error_free_host:
+ kfree(clp->cl_hostname);
error_cleanup:
put_nfs_version(clp->cl_nfs_mod);
error_dealloc:
put_nfs_version(clp->cl_nfs_mod);
kfree(clp->cl_hostname);
kfree(clp->cl_acceptor);
+ kfree(clp->clientid);
kfree_rcu(clp, rcu);
}
EXPORT_SYMBOL_GPL(nfs_free_client);
if (clp->cl_xprtsec.policy != data->xprtsec.policy)
continue;
+ if (data->clientid && data->clientid != clp->clientid)
+ continue;
+
refcount_inc(&clp->cl_count);
return clp;
}
Opt_xprtsec,
Opt_cert_serial,
Opt_privkey_serial,
+ Opt_clientid,
};
enum {
fsparam_string("xprtsec", Opt_xprtsec),
fsparam_s32("cert_serial", Opt_cert_serial),
fsparam_s32("privkey_serial", Opt_privkey_serial),
+ fsparam_string("clientid", Opt_clientid),
{}
};
goto out_invalid_value;
}
break;
+ case Opt_clientid:
+ if (!param->string || strlen(param->string) == 0 ||
+ strlen(param->string) > NFS4_CLIENT_ID_UNIQ_LEN - 1)
+ goto out_of_bounds;
+ kfree(ctx->clientid);
+ ctx->clientid = param->string;
+ param->string = NULL;
+ break;
/*
* Special options
ctx->nfs_server.hostname = NULL;
ctx->fscache_uniq = NULL;
ctx->clone_data.fattr = NULL;
+ ctx->clientid = NULL;
fc->fs_private = ctx;
return 0;
}
kfree(ctx->fscache_uniq);
nfs_free_fhandle(ctx->mntfh);
nfs_free_fattr(ctx->clone_data.fattr);
+ kfree(ctx->clientid);
kfree(ctx);
}
}
struct xprtsec_parms xprtsec;
unsigned long connect_timeout;
unsigned long reconnect_timeout;
+ const char *clientid;
};
/*
unsigned short mountfamily;
bool has_sec_mnt_opts;
int lock_status;
+ char *clientid;
struct {
union {
.xprtsec = ctx->xprtsec,
.nconnect = ctx->nfs_server.nconnect,
.max_connect = ctx->nfs_server.max_connect,
+ .clientid = ctx->clientid,
};
int error;
buf[0] = '\0';
+ if (clp->clientid) {
+ strscpy(buf, clp->clientid, buflen);
+ goto out;
+ }
+
if (nn_clp) {
rcu_read_lock();
id = rcu_dereference(nn_clp->identifier);
if (nfs4_client_id_uniquifier[0] != '\0' && buf[0] == '\0')
strscpy(buf, nfs4_client_id_uniquifier, buflen);
-
+out:
return strlen(buf);
}
netns_tracker cl_ns_tracker;
struct list_head pending_cb_stateids;
struct rcu_head rcu;
+ const char *clientid;
#if IS_ENABLED(CONFIG_NFS_LOCALIO)
struct timespec64 cl_nfssvc_boot;