Lines Matching refs:ctx

275 static void nfs_validate_transport_protocol(struct nfs_fs_context *ctx)
277 switch (ctx->nfs_server.protocol) {
283 ctx->nfs_server.protocol = XPRT_TRANSPORT_TCP;
291 static void nfs_set_mount_transport_protocol(struct nfs_fs_context *ctx)
293 nfs_validate_transport_protocol(ctx);
295 if (ctx->mount_server.protocol == XPRT_TRANSPORT_UDP ||
296 ctx->mount_server.protocol == XPRT_TRANSPORT_TCP)
298 switch (ctx->nfs_server.protocol) {
300 ctx->mount_server.protocol = XPRT_TRANSPORT_UDP;
304 ctx->mount_server.protocol = XPRT_TRANSPORT_TCP;
338 struct nfs_fs_context *ctx = nfs_fc2context(fc);
386 ret = nfs_auth_info_add(fc, &ctx->auth_info, pseudoflavor);
397 struct nfs_fs_context *ctx = nfs_fc2context(fc);
399 ctx->flags &= ~NFS_MOUNT_VER3;
402 ctx->version = 2;
405 ctx->flags |= NFS_MOUNT_VER3;
406 ctx->version = 3;
413 ctx->version = 4;
416 ctx->version = 4;
417 ctx->minorversion = 0;
420 ctx->version = 4;
421 ctx->minorversion = 1;
424 ctx->version = 4;
425 ctx->minorversion = 2;
440 struct nfs_fs_context *ctx = nfs_fc2context(fc);
449 return ctx->sloppy ? 1 : opt;
463 ctx->flags |= NFS_MOUNT_SOFT;
464 ctx->flags &= ~NFS_MOUNT_SOFTERR;
467 ctx->flags |= NFS_MOUNT_SOFTERR | NFS_MOUNT_SOFTREVAL;
468 ctx->flags &= ~NFS_MOUNT_SOFT;
471 ctx->flags &= ~(NFS_MOUNT_SOFT |
477 ctx->flags &= ~NFS_MOUNT_SOFTREVAL;
479 ctx->flags |= NFS_MOUNT_SOFTREVAL;
483 ctx->flags &= ~NFS_MOUNT_POSIX;
485 ctx->flags |= NFS_MOUNT_POSIX;
489 ctx->flags |= NFS_MOUNT_NOCTO;
491 ctx->flags &= ~NFS_MOUNT_NOCTO;
495 ctx->flags |= NFS_MOUNT_NOAC;
497 ctx->flags &= ~NFS_MOUNT_NOAC;
501 ctx->flags |= NFS_MOUNT_NONLM;
502 ctx->flags |= (NFS_MOUNT_LOCAL_FLOCK | NFS_MOUNT_LOCAL_FCNTL);
504 ctx->flags &= ~NFS_MOUNT_NONLM;
505 ctx->flags &= ~(NFS_MOUNT_LOCAL_FLOCK | NFS_MOUNT_LOCAL_FCNTL);
509 ctx->flags &= ~NFS_MOUNT_TCP;
510 ctx->nfs_server.protocol = XPRT_TRANSPORT_UDP;
513 ctx->flags |= NFS_MOUNT_TCP;
514 ctx->nfs_server.protocol = XPRT_TRANSPORT_TCP;
517 ctx->flags |= NFS_MOUNT_TCP; /* for side protocols */
518 ctx->nfs_server.protocol = XPRT_TRANSPORT_RDMA;
523 ctx->flags |= NFS_MOUNT_NOACL;
525 ctx->flags &= ~NFS_MOUNT_NOACL;
529 ctx->flags |= NFS_MOUNT_NORDIRPLUS;
531 ctx->flags &= ~NFS_MOUNT_NORDIRPLUS;
535 ctx->flags |= NFS_MOUNT_UNSHARED;
537 ctx->flags &= ~NFS_MOUNT_UNSHARED;
541 ctx->flags |= NFS_MOUNT_NORESVPORT;
543 ctx->flags &= ~NFS_MOUNT_NORESVPORT;
547 ctx->options &= ~NFS_OPTION_FSCACHE;
549 ctx->options |= NFS_OPTION_FSCACHE;
550 kfree(ctx->fscache_uniq);
551 ctx->fscache_uniq = NULL;
554 ctx->options |= NFS_OPTION_FSCACHE;
555 kfree(ctx->fscache_uniq);
556 ctx->fscache_uniq = param->string;
561 ctx->options &= ~NFS_OPTION_MIGRATION;
563 ctx->options |= NFS_OPTION_MIGRATION;
572 ctx->nfs_server.port = result.uint_32;
575 ctx->rsize = result.uint_32;
578 ctx->wsize = result.uint_32;
581 ctx->bsize = result.uint_32;
586 ctx->timeo = result.uint_32;
591 ctx->retrans = result.uint_32;
594 ctx->acregmin = result.uint_32;
597 ctx->acregmax = result.uint_32;
600 ctx->acdirmin = result.uint_32;
603 ctx->acdirmax = result.uint_32;
606 ctx->acregmin = result.uint_32;
607 ctx->acregmax = result.uint_32;
608 ctx->acdirmin = result.uint_32;
609 ctx->acdirmax = result.uint_32;
612 ctx->namlen = result.uint_32;
617 ctx->mount_server.port = result.uint_32;
623 ctx->mount_server.version = result.uint_32;
628 ctx->minorversion = result.uint_32;
657 ctx->flags &= ~NFS_MOUNT_TCP;
658 ctx->nfs_server.protocol = XPRT_TRANSPORT_UDP;
664 ctx->flags |= NFS_MOUNT_TCP;
665 ctx->nfs_server.protocol = XPRT_TRANSPORT_TCP;
672 ctx->flags |= NFS_MOUNT_TCP;
673 ctx->nfs_server.protocol = XPRT_TRANSPORT_RDMA;
680 ctx->protofamily = protofamily;
690 ctx->mount_server.protocol = XPRT_TRANSPORT_UDP;
696 ctx->mount_server.protocol = XPRT_TRANSPORT_TCP;
702 ctx->mountfamily = mountfamily;
707 &ctx->nfs_server.address,
708 sizeof(ctx->nfs_server._address));
711 ctx->nfs_server.addrlen = len;
714 kfree(ctx->client_address);
715 ctx->client_address = param->string;
719 kfree(ctx->mount_server.hostname);
720 ctx->mount_server.hostname = param->string;
725 &ctx->mount_server.address,
726 sizeof(ctx->mount_server._address));
729 ctx->mount_server.addrlen = len;
734 ctx->nfs_server.nconnect = result.uint_32;
739 ctx->flags &= ~(NFS_MOUNT_LOOKUP_CACHE_NONEG|NFS_MOUNT_LOOKUP_CACHE_NONE);
742 ctx->flags &= ~NFS_MOUNT_LOOKUP_CACHE_NONE;
743 ctx->flags |= NFS_MOUNT_LOOKUP_CACHE_NONEG;
746 ctx->flags |= NFS_MOUNT_LOOKUP_CACHE_NONEG|NFS_MOUNT_LOOKUP_CACHE_NONE;
755 ctx->flags |= (NFS_MOUNT_LOCAL_FLOCK |
759 ctx->flags |= NFS_MOUNT_LOCAL_FLOCK;
762 ctx->flags |= NFS_MOUNT_LOCAL_FCNTL;
765 ctx->flags &= ~(NFS_MOUNT_LOCAL_FLOCK |
777 ctx->sloppy = true;
804 struct nfs_fs_context *ctx = nfs_fc2context(fc);
839 kfree(ctx->nfs_server.hostname);
842 ctx->nfs_server.hostname = kmemdup_nul(dev_name, len, GFP_KERNEL);
843 if (!ctx->nfs_server.hostname)
848 ctx->nfs_server.export_path = kmemdup_nul(end, len, GFP_KERNEL);
849 if (!ctx->nfs_server.export_path)
852 dfprintk(MOUNT, "NFS: MNTPATH: '%s'\n", ctx->nfs_server.export_path);
892 struct nfs_fs_context *ctx = nfs_fc2context(fc);
893 struct nfs_fh *mntfh = ctx->mntfh;
894 struct sockaddr *sap = (struct sockaddr *)&ctx->nfs_server.address;
900 ctx->version = NFS_DEFAULT_VERSION;
928 ctx->version = 3;
931 ctx->version = 2;
953 ctx->flags = data->flags & NFS_MOUNT_FLAGMASK;
954 ctx->flags |= extra_flags;
955 ctx->rsize = data->rsize;
956 ctx->wsize = data->wsize;
957 ctx->timeo = data->timeo;
958 ctx->retrans = data->retrans;
959 ctx->acregmin = data->acregmin;
960 ctx->acregmax = data->acregmax;
961 ctx->acdirmin = data->acdirmin;
962 ctx->acdirmax = data->acdirmax;
963 ctx->need_mount = false;
966 ctx->nfs_server.addrlen = sizeof(data->addr);
967 ctx->nfs_server.port = ntohs(data->addr.sin_port);
973 ctx->nfs_server.protocol = XPRT_TRANSPORT_UDP;
975 ctx->nfs_server.hostname = kstrdup(data->hostname, GFP_KERNEL);
976 if (!ctx->nfs_server.hostname)
979 ctx->namlen = data->namlen;
980 ctx->bsize = data->bsize;
983 ctx->selected_flavor = data->pseudoflavor;
985 ctx->selected_flavor = RPC_AUTH_UNIX;
988 ctx->flags &= ~(NFS_MOUNT_LOCAL_FLOCK|
991 ctx->flags |= (NFS_MOUNT_LOCAL_FLOCK|
1021 ctx->skip_reconfig_option_check = true;
1029 ctx->skip_reconfig_option_check = true;
1120 struct nfs_fs_context *ctx = nfs_fc2context(fc);
1121 struct sockaddr *sap = (struct sockaddr *)&ctx->nfs_server.address;
1131 ctx->version = 4;
1139 if (data->host_addrlen > sizeof(ctx->nfs_server.address))
1143 ctx->nfs_server.addrlen = data->host_addrlen;
1148 ctx->nfs_server.port = ntohs(((struct sockaddr_in *)sap)->sin_port);
1158 ctx->selected_flavor = pseudoflavor;
1160 ctx->selected_flavor = RPC_AUTH_UNIX;
1166 ctx->nfs_server.hostname = c;
1171 ctx->nfs_server.export_path = c;
1177 ctx->client_address = c;
1184 ctx->flags = data->flags & NFS4_MOUNT_FLAGMASK;
1185 ctx->rsize = data->rsize;
1186 ctx->wsize = data->wsize;
1187 ctx->timeo = data->timeo;
1188 ctx->retrans = data->retrans;
1189 ctx->acregmin = data->acregmin;
1190 ctx->acregmax = data->acregmax;
1191 ctx->acdirmin = data->acdirmin;
1192 ctx->acdirmax = data->acdirmax;
1193 ctx->nfs_server.protocol = data->proto;
1194 nfs_validate_transport_protocol(ctx);
1195 if (ctx->nfs_server.protocol == XPRT_TRANSPORT_UDP)
1198 ctx->skip_reconfig_option_check = true;
1235 struct nfs_fs_context *ctx = nfs_fc2context(fc);
1237 struct sockaddr *sap = (struct sockaddr *)&ctx->nfs_server.address;
1247 if (ctx->minorversion && ctx->version != 4)
1250 if (ctx->options & NFS_OPTION_MIGRATION &&
1251 (ctx->version != 4 || ctx->minorversion != 0))
1257 if (ctx->protofamily != AF_UNSPEC &&
1258 ctx->protofamily != ctx->nfs_server.address.sa_family)
1261 if (ctx->mountfamily != AF_UNSPEC) {
1262 if (ctx->mount_server.addrlen) {
1263 if (ctx->mountfamily != ctx->mount_server.address.sa_family)
1266 if (ctx->mountfamily != ctx->nfs_server.address.sa_family)
1274 if (ctx->version == 4) {
1276 if (ctx->nfs_server.protocol == XPRT_TRANSPORT_RDMA)
1282 nfs_validate_transport_protocol(ctx);
1283 if (ctx->nfs_server.protocol == XPRT_TRANSPORT_UDP)
1285 ctx->flags &= ~(NFS_MOUNT_NONLM | NFS_MOUNT_NOACL |
1292 nfs_set_mount_transport_protocol(ctx);
1294 if (ctx->nfs_server.protocol == XPRT_TRANSPORT_UDP)
1297 if (ctx->nfs_server.protocol == XPRT_TRANSPORT_RDMA)
1301 nfs_set_port(sap, &ctx->nfs_server.port, port);
1308 if (!ctx->nfs_mod) {
1309 nfs_mod = get_nfs_version(ctx->version);
1314 ctx->nfs_mod = nfs_mod;
1318 if (fc->fs_type != ctx->nfs_mod->nfs_fs) {
1320 __module_get(ctx->nfs_mod->nfs_fs->owner);
1321 fc->fs_type = ctx->nfs_mod->nfs_fs;
1340 ctx->version, ctx->minorversion);
1353 struct nfs_fs_context *ctx = nfs_fc2context(fc);
1358 if (!ctx->internal)
1359 return ctx->nfs_mod->rpc_ops->try_get_tree(fc);
1372 struct nfs_fs_context *src = nfs_fc2context(src_fc), *ctx;
1374 ctx = kmemdup(src, sizeof(struct nfs_fs_context), GFP_KERNEL);
1375 if (!ctx)
1378 ctx->mntfh = nfs_alloc_fhandle();
1379 if (!ctx->mntfh) {
1380 kfree(ctx);
1383 nfs_copy_fh(ctx->mntfh, src->mntfh);
1385 __module_get(ctx->nfs_mod->owner);
1386 ctx->client_address = NULL;
1387 ctx->mount_server.hostname = NULL;
1388 ctx->nfs_server.export_path = NULL;
1389 ctx->nfs_server.hostname = NULL;
1390 ctx->fscache_uniq = NULL;
1391 ctx->clone_data.fattr = NULL;
1392 fc->fs_private = ctx;
1398 struct nfs_fs_context *ctx = nfs_fc2context(fc);
1400 if (ctx) {
1401 if (ctx->server)
1402 nfs_free_server(ctx->server);
1403 if (ctx->nfs_mod)
1404 put_nfs_version(ctx->nfs_mod);
1405 kfree(ctx->client_address);
1406 kfree(ctx->mount_server.hostname);
1407 kfree(ctx->nfs_server.export_path);
1408 kfree(ctx->nfs_server.hostname);
1409 kfree(ctx->fscache_uniq);
1410 nfs_free_fhandle(ctx->mntfh);
1411 nfs_free_fattr(ctx->clone_data.fattr);
1412 kfree(ctx);
1432 struct nfs_fs_context *ctx;
1434 ctx = kzalloc(sizeof(struct nfs_fs_context), GFP_KERNEL);
1435 if (unlikely(!ctx))
1438 ctx->mntfh = nfs_alloc_fhandle();
1439 if (unlikely(!ctx->mntfh)) {
1440 kfree(ctx);
1444 ctx->protofamily = AF_UNSPEC;
1445 ctx->mountfamily = AF_UNSPEC;
1446 ctx->mount_server.port = NFS_UNSPEC_PORT;
1453 ctx->flags = nfss->flags;
1454 ctx->rsize = nfss->rsize;
1455 ctx->wsize = nfss->wsize;
1456 ctx->retrans = nfss->client->cl_timeout->to_retries;
1457 ctx->selected_flavor = nfss->client->cl_auth->au_flavor;
1458 ctx->acregmin = nfss->acregmin / HZ;
1459 ctx->acregmax = nfss->acregmax / HZ;
1460 ctx->acdirmin = nfss->acdirmin / HZ;
1461 ctx->acdirmax = nfss->acdirmax / HZ;
1462 ctx->timeo = 10U * nfss->client->cl_timeout->to_initval / HZ;
1463 ctx->nfs_server.port = nfss->port;
1464 ctx->nfs_server.addrlen = nfss->nfs_client->cl_addrlen;
1465 ctx->version = nfss->nfs_client->rpc_ops->version;
1466 ctx->minorversion = nfss->nfs_client->cl_minorversion;
1468 memcpy(&ctx->nfs_server.address, &nfss->nfs_client->cl_addr,
1469 ctx->nfs_server.addrlen);
1476 ctx->nfs_mod = nfss->nfs_client->cl_nfs_mod;
1477 __module_get(ctx->nfs_mod->owner);
1480 ctx->timeo = NFS_UNSPEC_TIMEO;
1481 ctx->retrans = NFS_UNSPEC_RETRANS;
1482 ctx->acregmin = NFS_DEF_ACREGMIN;
1483 ctx->acregmax = NFS_DEF_ACREGMAX;
1484 ctx->acdirmin = NFS_DEF_ACDIRMIN;
1485 ctx->acdirmax = NFS_DEF_ACDIRMAX;
1486 ctx->nfs_server.port = NFS_UNSPEC_PORT;
1487 ctx->nfs_server.protocol = XPRT_TRANSPORT_TCP;
1488 ctx->selected_flavor = RPC_AUTH_MAXFLAVOR;
1489 ctx->minorversion = 0;
1490 ctx->need_mount = true;
1492 fc->fs_private = ctx;