Lines Matching +full:non +full:- +full:negative

1 // SPDX-License-Identifier: GPL-2.0-only
103 ino_t ino = file_inode(file)->i_ino; in nfsctl_transaction_write()
108 return -EINVAL; in nfsctl_transaction_write()
124 if (! file->private_data) { in nfsctl_transaction_read()
126 * causes a 0-byte write so that the file can return in nfsctl_transaction_read()
153 seq = file->private_data; in exports_net_open()
154 seq->private = nn->svc_export_cache; in exports_net_open()
160 return exports_net_open(inode->i_sb->s_fs_info, file); in exports_nfsd_open()
189 /*----------------------------------------------------------------------------*/
191 * payload - write methods
196 return file_inode(file)->i_sb->s_fs_info; in netns()
200 * write_unlock_ip - Release all locks used by a client
205 * buf: '\n'-terminated C string containing a
211 * On error: return code is negative errno value
223 return -EINVAL; in write_unlock_ip()
225 if (buf[size-1] != '\n') in write_unlock_ip()
226 return -EINVAL; in write_unlock_ip()
230 return -EINVAL; in write_unlock_ip()
233 return -EINVAL; in write_unlock_ip()
240 * write_unlock_fs - Release all locks on a local file system
245 * buf: '\n'-terminated C string containing the
251 * On error: return code is negative errno value
261 return -EINVAL; in write_unlock_fs()
263 if (buf[size-1] != '\n') in write_unlock_fs()
264 return -EINVAL; in write_unlock_fs()
268 return -EINVAL; in write_unlock_fs()
283 error = nlmsvc_unlock_all_by_sb(path.dentry->d_sb); in write_unlock_fs()
290 * write_filehandle - Get a variable-length NFS file handle by path
292 * On input, the buffer contains a '\n'-terminated C string comprised of
304 * On success: passed-in buffer filled with '\n'-terminated C
308 * On error: return code is negative errno value
320 return -EINVAL; in write_filehandle()
322 if (buf[size-1] != '\n') in write_filehandle()
323 return -EINVAL; in write_filehandle()
324 buf[size-1] = 0; in write_filehandle()
329 return -EINVAL; in write_filehandle()
334 return -EINVAL; in write_filehandle()
341 return -EINVAL; in write_filehandle()
345 return -EINVAL; in write_filehandle()
352 return -ENOMEM; in write_filehandle()
362 mesg[-1] = '\n'; in write_filehandle()
363 return mesg - buf; in write_filehandle()
367 * write_threads - Start NFSD, or report the current number of running threads
373 * On success: passed-in buffer filled with '\n'-terminated C
385 * size: non-zero length of C string in @buf
388 * passed-in buffer filled with '\n'-terminated C
392 * On error: return code is zero or a negative errno value
406 return -EINVAL; in write_threads()
408 rv = nfsd_svc(newthreads, net, file->f_cred); in write_threads()
418 * write_pool_threads - Set or report the current number of threads per pool
427 * buf: C string containing whitespace-
431 * size: non-zero length of C string in @buf
433 * On success: passed-in buffer filled with '\n'-terminated C
437 * On error: return code is zero or a negative errno value
466 rv = -ENOMEM; in write_pool_threads()
473 if (rv == -ENOENT) in write_pool_threads()
477 rv = -EINVAL; in write_pool_threads()
494 snprintf(mesg, size, "%d%c", nthreads[i], (i == npools-1 ? '\n' : ' ')); in write_pool_threads()
496 size -= len; in write_pool_threads()
499 rv = mesg - buf; in write_pool_threads()
520 * +4, unless -4.0 is present. in nfsd_print_version_support()
524 supported ? '+' : '-', vers, minor); in nfsd_print_version_support()
537 if (nn->nfsd_serv) in __write_versions()
539 * nn->nfsd_serv->sv_xdrsize, and reallocing in __write_versions()
542 return -EBUSY; in __write_versions()
543 if (buf[size-1] != '\n') in __write_versions()
544 return -EINVAL; in __write_versions()
545 buf[size-1] = 0; in __write_versions()
550 if (len <= 0) return -EINVAL; in __write_versions()
555 if (sign == '+' || sign == '-') in __write_versions()
561 return -EINVAL; in __write_versions()
563 return -EINVAL; in __write_versions()
566 cmd = sign == '-' ? NFSD_CLEAR : NFSD_SET; in __write_versions()
577 return -EINVAL; in __write_versions()
581 * or we have -4 and at least one minor is enabled. in __write_versions()
590 /* Ignore requests to disable non-existent versions */ in __write_versions()
592 return -EINVAL; in __write_versions()
610 minor = -1; in __write_versions()
616 remaining -= len; in __write_versions()
627 return -EINVAL; in __write_versions()
632 * write_versions - Set or report the available NFS protocol versions
638 * On success: passed-in buffer filled with '\n'-terminated C
639 * string containing positive or negative integer
643 * On error: return code is zero or a negative errno value
648 * buf: C string containing whitespace-
649 * separated positive or negative
652 * or disable ("-n")
653 * size: non-zero length of C string in @buf
656 * been updated; passed-in buffer filled with
657 * '\n'-terminated C string containing positive
658 * or negative integer values representing the
661 * On error: return code is zero or a negative errno value
674 * Zero-length write. Return a list of NFSD's current listener
681 if (nn->nfsd_serv == NULL) in __write_ports_names()
683 return svc_xprt_names(nn->nfsd_serv, buf, SIMPLE_TRANSACTION_LIMIT); in __write_ports_names()
700 return -EINVAL; in __write_ports_addfd()
707 serv = nn->nfsd_serv; in __write_ports_addfd()
710 if (!serv->sv_nrthreads && list_empty(&nn->nfsd_serv->sv_permsocks)) in __write_ports_addfd()
729 return -EINVAL; in __write_ports_addxprt()
732 return -EINVAL; in __write_ports_addxprt()
739 serv = nn->nfsd_serv; in __write_ports_addxprt()
747 if (err < 0 && err != -EAFNOSUPPORT) in __write_ports_addxprt()
758 if (!serv->sv_nrthreads && list_empty(&nn->nfsd_serv->sv_permsocks)) in __write_ports_addxprt()
771 return __write_ports_addfd(buf, net, file->f_cred); in __write_ports()
774 return __write_ports_addxprt(buf, net, file->f_cred); in __write_ports()
776 return -EINVAL; in __write_ports()
780 * write_ports - Pass a socket file descriptor or transport name to listen on
786 * On success: passed-in buffer filled with a '\n'-terminated C
787 * string containing a whitespace-separated list of
790 * On error: return code is zero or a negative errno value
801 * size: non-zero length of C string in @buf
804 * passed-in buffer filled with a '\n'-terminated C
808 * On error: return code is a negative errno value
817 * size: non-zero length of C string in @buf
820 * On error: return code is a negative errno value
836 * write_maxblksize - Set or report the current NFS blksize
848 * size: non-zero length of C string in @buf
850 * On success: passed-in buffer filled with '\n'-terminated C string
854 * On error: return code is zero or a negative errno value
873 bsize &= ~(1024-1); in write_maxblksize()
875 if (nn->nfsd_serv) { in write_maxblksize()
877 return -EBUSY; in write_maxblksize()
888 * write_maxconn - Set or report the current max number of connections
899 * size: non-zero length of C string in @buf
901 * On success: passed-in buffer filled with '\n'-terminated C string
905 * On error: return code is zero or a negative errno value
911 unsigned int maxconn = nn->max_connections; in write_maxconn()
919 nn->max_connections = maxconn; in write_maxconn()
934 if (nn->nfsd_serv) in __nfsd4_write_time()
935 return -EBUSY; in __nfsd4_write_time()
939 trace_nfsd_ctl_time(netns(file), dentry->d_name.name, in __nfsd4_write_time()
940 dentry->d_name.len, i); in __nfsd4_write_time()
946 * - Too short: the briefest network outage may in __nfsd4_write_time()
949 * - Too long: do you really want reboot recovery in __nfsd4_write_time()
955 return -EINVAL; in __nfsd4_write_time()
974 * write_leasetime - Set or report the current NFSv4 lease time
986 * size: non-zero length of C string in @buf
988 * On success: passed-in buffer filled with '\n'-terminated C
992 * On error: return code is zero or a negative errno value
997 return nfsd4_write_time(file, buf, size, &nn->nfsd4_lease, nn); in write_leasetime()
1001 * write_gracetime - Set or report current NFSv4 grace period time
1006 * lease-period time, but we don't try to enforce this. (In the common
1013 return nfsd4_write_time(file, buf, size, &nn->nfsd4_grace, nn); in write_gracetime()
1025 if (nn->nfsd_serv) in __write_recoverydir()
1026 return -EBUSY; in __write_recoverydir()
1027 if (size > PATH_MAX || buf[size-1] != '\n') in __write_recoverydir()
1028 return -EINVAL; in __write_recoverydir()
1029 buf[size-1] = 0; in __write_recoverydir()
1034 return -EINVAL; in __write_recoverydir()
1047 * write_recoverydir - Set or report the pathname of the recovery directory
1060 * size: non-zero length of C string in @buf
1062 * On success: passed-in buffer filled with '\n'-terminated C string
1065 * On error: return code is zero or a negative errno value
1080 * write_v4_end_grace - release grace period for nfsd's v4.x lock manager
1089 * size: non-zero length of C string in @buf
1091 * passed-in buffer filled with "Y" or "N" with a newline
1092 * and NULL-terminated C string. This indicates whether
1108 if (!nn->nfsd_serv) in write_v4_end_grace()
1109 return -EBUSY; in write_v4_end_grace()
1114 return -EINVAL; in write_v4_end_grace()
1119 nn->grace_ended ? 'Y' : 'N'); in write_v4_end_grace()
1124 /*----------------------------------------------------------------------------*/
1136 inode->i_ino = iunique(sb, NFSD_MaxReserved); in nfsd_get_inode()
1137 inode->i_mode = mode; in nfsd_get_inode()
1141 inode->i_fop = &simple_dir_operations; in nfsd_get_inode()
1142 inode->i_op = &simple_dir_inode_operations; in nfsd_get_inode()
1146 inode->i_op = &simple_symlink_inode_operations; in nfsd_get_inode()
1158 inode = nfsd_get_inode(dir->i_sb, mode); in __nfsd_mkdir()
1160 return -ENOMEM; in __nfsd_mkdir()
1162 inode->i_private = ncl; in __nfsd_mkdir()
1163 kref_get(&ncl->cl_ref); in __nfsd_mkdir()
1173 struct inode *dir = parent->d_inode; in nfsd_mkdir()
1175 int ret = -ENOMEM; in nfsd_mkdir()
1199 inode = nfsd_get_inode(dir->i_sb, mode); in __nfsd_symlink()
1201 return -ENOMEM; in __nfsd_symlink()
1203 inode->i_link = (char *)content; in __nfsd_symlink()
1204 inode->i_size = strlen(content); in __nfsd_symlink()
1213 * @content is assumed to be a NUL-terminated string that lives
1219 struct inode *dir = parent->d_inode; in _nfsd_symlink()
1244 struct nfsdfs_client *ncl = inode->i_private; in clear_ncl()
1246 spin_lock(&inode->i_lock); in clear_ncl()
1247 inode->i_private = NULL; in clear_ncl()
1248 spin_unlock(&inode->i_lock); in clear_ncl()
1249 kref_put(&ncl->cl_ref, ncl->cl_release); in clear_ncl()
1256 spin_lock(&inode->i_lock); in get_nfsdfs_client()
1257 nc = inode->i_private; in get_nfsdfs_client()
1259 kref_get(&nc->cl_ref); in get_nfsdfs_client()
1260 spin_unlock(&inode->i_lock); in get_nfsdfs_client()
1277 for (i = 0; files->name && files->name[0]; i++, files++) { in nfsdfs_create_files()
1278 dentry = d_alloc_name(root, files->name); in nfsdfs_create_files()
1281 inode = nfsd_get_inode(d_inode(root)->i_sb, in nfsdfs_create_files()
1282 S_IFREG | files->mode); in nfsdfs_create_files()
1287 kref_get(&ncl->cl_ref); in nfsdfs_create_files()
1288 inode->i_fop = files->ops; in nfsdfs_create_files()
1289 inode->i_private = ncl; in nfsdfs_create_files()
1299 return -ENOMEM; in nfsdfs_create_files()
1314 dentry = nfsd_mkdir(nn->nfsd_client_dir, ncl, name); in nfsd_client_mkdir()
1333 struct nfsd_net *nn = net_generic(current->nsproxy->net_ns, in nfsd_fill_super()
1340 /* Per-export io stats use same ops as exports file */ in nfsd_fill_super()
1371 _nfsd_symlink(sb->s_root, "supported_krb5_enctypes", in nfsd_fill_super()
1373 dentry = nfsd_mkdir(sb->s_root, NULL, "clients"); in nfsd_fill_super()
1376 nn->nfsd_client_dir = dentry; in nfsd_fill_super()
1382 return get_tree_keyed(fc, nfsd_fill_super, get_net(fc->net_ns)); in nfsd_fs_get_tree()
1387 if (fc->s_fs_info) in nfsd_fs_free_fc()
1388 put_net(fc->s_fs_info); in nfsd_fs_free_fc()
1398 put_user_ns(fc->user_ns); in nfsd_init_fs_context()
1399 fc->user_ns = get_user_ns(fc->net_ns->user_ns); in nfsd_init_fs_context()
1400 fc->ops = &nfsd_fs_context_ops; in nfsd_init_fs_context()
1406 struct net *net = sb->s_fs_info; in nfsd_umount()
1426 return exports_net_open(current->nsproxy->net_ns, file); in exports_proc_open()
1442 return -ENOMEM; in create_proc_exports_entry()
1446 return -ENOMEM; in create_proc_exports_entry()
1460 * nfsd_nl_rpc_status_get_start - Prepare rpc_status_get dumpit
1465 * %-ENODEV: There is no NFSD running in this namespace
1469 struct nfsd_net *nn = net_generic(sock_net(cb->skb->sk), nfsd_net_id); in nfsd_nl_rpc_status_get_start()
1470 int ret = -ENODEV; in nfsd_nl_rpc_status_get_start()
1473 if (nn->nfsd_serv) in nfsd_nl_rpc_status_get_start()
1488 hdr = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, in nfsd_genl_rpc_status_compose_msg()
1491 return -ENOBUFS; in nfsd_genl_rpc_status_compose_msg()
1493 if (nla_put_be32(skb, NFSD_A_RPC_STATUS_XID, rqstp->rq_xid) || in nfsd_genl_rpc_status_compose_msg()
1494 nla_put_u32(skb, NFSD_A_RPC_STATUS_FLAGS, rqstp->rq_flags) || in nfsd_genl_rpc_status_compose_msg()
1495 nla_put_u32(skb, NFSD_A_RPC_STATUS_PROG, rqstp->rq_prog) || in nfsd_genl_rpc_status_compose_msg()
1496 nla_put_u32(skb, NFSD_A_RPC_STATUS_PROC, rqstp->rq_proc) || in nfsd_genl_rpc_status_compose_msg()
1497 nla_put_u8(skb, NFSD_A_RPC_STATUS_VERSION, rqstp->rq_vers) || in nfsd_genl_rpc_status_compose_msg()
1499 ktime_to_us(rqstp->rq_stime), in nfsd_genl_rpc_status_compose_msg()
1501 return -ENOBUFS; in nfsd_genl_rpc_status_compose_msg()
1503 switch (rqstp->rq_saddr.sa_family) { in nfsd_genl_rpc_status_compose_msg()
1507 s_in = (const struct sockaddr_in *)&rqstp->rq_saddr; in nfsd_genl_rpc_status_compose_msg()
1508 d_in = (const struct sockaddr_in *)&rqstp->rq_daddr; in nfsd_genl_rpc_status_compose_msg()
1510 s_in->sin_addr.s_addr) || in nfsd_genl_rpc_status_compose_msg()
1512 d_in->sin_addr.s_addr) || in nfsd_genl_rpc_status_compose_msg()
1514 s_in->sin_port) || in nfsd_genl_rpc_status_compose_msg()
1516 d_in->sin_port)) in nfsd_genl_rpc_status_compose_msg()
1517 return -ENOBUFS; in nfsd_genl_rpc_status_compose_msg()
1523 s_in = (const struct sockaddr_in6 *)&rqstp->rq_saddr; in nfsd_genl_rpc_status_compose_msg()
1524 d_in = (const struct sockaddr_in6 *)&rqstp->rq_daddr; in nfsd_genl_rpc_status_compose_msg()
1526 &s_in->sin6_addr) || in nfsd_genl_rpc_status_compose_msg()
1528 &d_in->sin6_addr) || in nfsd_genl_rpc_status_compose_msg()
1530 s_in->sin6_port) || in nfsd_genl_rpc_status_compose_msg()
1532 d_in->sin6_port)) in nfsd_genl_rpc_status_compose_msg()
1533 return -ENOBUFS; in nfsd_genl_rpc_status_compose_msg()
1538 for (i = 0; i < rqstp->rq_opcnt; i++) in nfsd_genl_rpc_status_compose_msg()
1540 rqstp->rq_opnum[i])) in nfsd_genl_rpc_status_compose_msg()
1541 return -ENOBUFS; in nfsd_genl_rpc_status_compose_msg()
1548 * nfsd_nl_rpc_status_get_dumpit - Handle rpc_status_get dumpit
1552 * Returns the size of the reply or a negative errno.
1557 struct nfsd_net *nn = net_generic(sock_net(skb->sk), nfsd_net_id); in nfsd_nl_rpc_status_get_dumpit()
1562 for (i = 0; i < nn->nfsd_serv->sv_nrpools; i++) { in nfsd_nl_rpc_status_get_dumpit()
1565 if (i < cb->args[0]) /* already consumed */ in nfsd_nl_rpc_status_get_dumpit()
1570 &nn->nfsd_serv->sv_pools[i].sp_all_threads, in nfsd_nl_rpc_status_get_dumpit()
1575 if (rqstp_index++ < cb->args[1]) /* already consumed */ in nfsd_nl_rpc_status_get_dumpit()
1584 smp_load_acquire(&rqstp->rq_status_counter); in nfsd_nl_rpc_status_get_dumpit()
1588 genl_rqstp.rq_xid = rqstp->rq_xid; in nfsd_nl_rpc_status_get_dumpit()
1589 genl_rqstp.rq_flags = rqstp->rq_flags; in nfsd_nl_rpc_status_get_dumpit()
1590 genl_rqstp.rq_vers = rqstp->rq_vers; in nfsd_nl_rpc_status_get_dumpit()
1591 genl_rqstp.rq_prog = rqstp->rq_prog; in nfsd_nl_rpc_status_get_dumpit()
1592 genl_rqstp.rq_proc = rqstp->rq_proc; in nfsd_nl_rpc_status_get_dumpit()
1593 genl_rqstp.rq_stime = rqstp->rq_stime; in nfsd_nl_rpc_status_get_dumpit()
1601 if (rqstp->rq_vers == NFS4_VERSION && in nfsd_nl_rpc_status_get_dumpit()
1602 rqstp->rq_proc == NFSPROC4_COMPOUND) { in nfsd_nl_rpc_status_get_dumpit()
1607 args = rqstp->rq_argp; in nfsd_nl_rpc_status_get_dumpit()
1608 genl_rqstp.rq_opcnt = args->opcnt; in nfsd_nl_rpc_status_get_dumpit()
1611 args->ops[j].opnum; in nfsd_nl_rpc_status_get_dumpit()
1619 if (smp_load_acquire(&rqstp->rq_status_counter) != in nfsd_nl_rpc_status_get_dumpit()
1630 cb->args[0] = i; in nfsd_nl_rpc_status_get_dumpit()
1631 cb->args[1] = rqstp_index; in nfsd_nl_rpc_status_get_dumpit()
1632 ret = skb->len; in nfsd_nl_rpc_status_get_dumpit()
1640 * nfsd_nl_rpc_status_get_done - rpc_status_get dumpit post-processing
1654 * nfsd_net_init - Prepare the nfsd_net portion of a new net namespace
1655 * @net: a freshly-created network namespace
1661 * Returns zero on success, or a negative errno otherwise.
1677 nn->nfsd_versions = NULL; in nfsd_net_init()
1678 nn->nfsd4_minorversions = NULL; in nfsd_net_init()
1680 get_random_bytes(&nn->siphash_key, sizeof(nn->siphash_key)); in nfsd_net_init()
1681 seqlock_init(&nn->writeverf_lock); in nfsd_net_init()
1694 * nfsd_net_exit - Release the nfsd_net portion of a net namespace
1731 nfsd_lockd_init(); /* lockd->nfsd callbacks */ in init_nfsd()
1790 MODULE_DESCRIPTION("In-kernel NFS server");