summaryrefslogtreecommitdiff
path: root/utils
Commit message (Collapse)AuthorAgeFilesLines
* exports.man: Document reexport= optionRichard Weinberger2023-04-191-0/+31
| | | | | Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Steve Dickson <steved@redhat.com>
* Implement reexport= export optionRichard Weinberger2023-04-195-2/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When re-exporting a NFS volume it is mandatory to specify either a UUID or numerical fsid= option because nfsd is unable to derive an identifier on its own. For NFS cross mounts this becomes a problem because nfsd also needs an identifier for every crossed mount. A common workaround is stating every single subvolume in the exports list too. But this defeats the purpose of the crossmnt option and is tedious. This is where the reexport= tries to help. It offers various strategies to automatically derive a identifier for NFS volumes and sub volumes. Currently two strategies are implemented: 1. auto-fsidnum In this mode mountd/exportd will create a new numerical fsid for a NFS volume and subvolume. The numbers are stored in a database, via fsidd, such that the server will always use the same fsid. The entry in the exports file allowed to skip the fsid= option but stating a UUID is allowed, if needed. This mode has the obvious downside that load balancing is by default not possible since multiple re-exporting NFS servers would generate different ids. It is possible if all load balancers use the same database. This can be achieved by using nfs-utils' fsidd and placing it's sqlit database on a network share which supports file locks or by implementing your own fsidd which is able to provide consistent fsids across multiple re-exporting nfs servers. 2. predefined-fsidnum This mode works just like auto-fsidnum but does not generate ids for you. It helps in the load balancing case. A system administrator has to manually maintain the database and install it on all re-exporting NFS servers. If you have a massive amount of subvolumes this mode will help because you don't have to bloat the exports list. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs(5): Document the new "xprtsec=" mount optionnfs-utils-2-6-3-rc8Chuck Lever2023-04-151-1/+33
| | | | | | | | More information about RPC-with-TLS and some brief set-up guidance are to be provided in a separate man page in Section 7. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* exports(5): Describe the xprtsec= export optionChuck Lever2023-04-151-1/+50
| | | | | | Cc: Rick Macklem <rick.macklem@gmail.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* exports: Add an xprtsec= export optionChuck Lever2023-04-151-0/+1
| | | | | | | | | | | The overall goal is to enable administrators to require the use of transport layer security when clients access particular exports. This patch adds support to exportfs to parse, display, and push into the kernel a new xprtsec= export option. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsd.man: fix typo in section on "scope".nfs-utils-2-6-3-rc7NeilBrown2023-04-051-1/+1
| | | | | | | The missing "-" means that "-S" isn't mentioned at all. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: always include mountpoint or spec if error messages.NeilBrown2023-04-051-15/+16
| | | | | | | | | | | | | | | If you try to mount from a server that is inaccessible you might get an error like: mount.nfs: No route to host This is OK when running "mount" interactively, but hardly useful when found in system logs. This patch changes mount_error() to always included at least one of mount_point and spec in any error message. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsmount.conf: Fix typo of the attribute nameYongcheng Yang2023-04-051-3/+3
| | | | | Signed-off-by: Yongcheng Yang <yongcheng.yang@gmail.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Replace statfs64 with statfsKhem Raj2023-01-101-2/+2
| | | | | | | | | | | | | | autoconf AC_SYS_LARGEFILE is used by configure to add needed defines when needed for enabling 64bit off_t, therefore replacing statfs64 with statfs should be functionally same. Additionally this helps compiling with latest musl where 64bit LFS functions like statfs64 and friends are now moved under _LARGEFILE64_SOURCE feature test macro, this works on glibc systems because _GNU_SOURCE macros also enables _LARGEFILE64_SOURCE indirectly. This is not case with musl and this latest issue is exposed. Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsd: allow server scope to be set with config or command line.nfs-utils-2-6-3-rc4NeilBrown2022-11-212-2/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | NFSv4.1 and later require the server to report a "scope". Servers with the same scope are expected to understand each other's state ids etc, though may not accept them - this ensure there can be no misunderstanding. This is helpful for migration. Servers with different scope are known to be different and if a server appears to change scope on a restart, lock recovery must not be attempted. It is important for fail-over configurations to have the same scope for all server instances. Linux NFSD sets scope to host name. It is common for fail-over configurations to use different host names on different server nodes. So the default is not good for these configurations and must be over-ridden. As discussed in https://github.com/ClusterLabs/resource-agents/issues/1644 some HA management tools attempt to address this with calls to "unshare" and "hostname" before running "rpc.nfsd". This is unnecessarily cumbersome. This patch adds a "-S" command-line option and nfsd.scope config value so that the scope can be set easily for nfsd. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-blkmapd: PID file read by systemd failedzhanchengbin2022-11-191-16/+32
| | | | | | | | | | | | | | | | | When started nfs-blkmap.service, the PID file can't be opened, The cause is that the child process does not create the PID file before the systemd reads the PID file. Adding "ExecStartPost=/bin/sleep 0.1" to /usr/lib/systemd/system/nfs-blkmap.service will probably solve this problem, However, there is no guarantee that the above solutions are effective under high cpu pressure.So replace the daemon function with the fork function, and put the behavior of creating the PID file in the parent process to solve the above problems. Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsd.man: Explain that setting nfsv4=n turns off all v4 versionsnfs-utils-2-6-3-rc3Steve Dickson2022-11-041-1/+3
| | | | | | | Update the man page to explicitly say setting nfsv4=n turns off all v4 versions Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: fix NULL pointer derefernce in nfs_parse_square_bracketZhi Li2022-10-241-1/+2
| | | | | | | | | In function nfs_parse_square_bracket, hostname could be NULL, dereferencing it in free(*hostname) may cause an unexpected segfault. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2136807 Signed-off-by: Zhi Li <yieli@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* blkmapd: fix coredump in bl_add_diskLixiaokeng2022-10-243-14/+7
| | | | | | | | | | The serial->data is not malloced separately (just part of the serial), so it can't be freed. The bl_serial has its own free function. Use it. Signed-off-by: Lixiaokeng <lixiaokeng@huawei.com> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Fix more function prototypesSam James2022-09-271-1/+1
| | | | | | | | | | regex.c:545:43: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] struct trans_func *libnfsidmap_plugin_init() ^ void See: 167f2336b06e1bcbf26f45f2ddc4a535fed4d393 Signed-off-by: Sam James <sam@gentoo.org> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-blkmapd: Fix the error status when nfs-blkmapd stopsnfs-utils-2-6-3-rc1zhanchengbin2022-09-131-1/+1
| | | | | | | | | | | | | | | The systemctl stop nfs-blkmap.service will sends the SIGTERM signal to the nfs-blkmap.service first.If the process fails to be stopped, it sends the SIGKILL signal again to kill the process. However, exit(1) is executed in the SIGTERM processing function of nfs-blkmap.service. As a result, systemd receives an error message indicating that nfs-blkmap.service failed. "Active: failed" is displayed when the systemctl status nfs-blkmap.service command is executed. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Fix function prototypesKhem Raj2022-09-132-3/+3
| | | | | | | | | | Clang is now erroring out on functions with out parameter types Fixes errors like error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* svcgssd: Add (undocumented) config options to man pagenfs-utils-2-6-2-rc7Marcel Ritter2022-06-211-0/+13
| | | | | | | There seem to be some undocumented options implemented. Why not mention them in the man page? Signed-off-by: Steve Dickson <steved@redhat.com>
* svcgssd: Display principal if setMarcel Ritter2022-06-211-3/+3
| | | | | | | It's a little irritating to only see the template "<...>@<...>" if you set a specific principal name. So let's show it (if set). Signed-off-by: Steve Dickson <steved@redhat.com>
* svcgssd: Fix use-after-free bug (config variables)Marcel Ritter2022-06-211-3/+3
| | | | | | | | This patch fixes a bug when trying to set "principal" in /etc/nfs.conf. Memory gets freed by conf_cleanup() before being used - moving cleanup code resolves that. Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsidmap.man: Fix section numbernfs-utils-2-6-2-rc4Steve Dickson2022-04-191-1/+1
| | | | | | | | | | | The nfsidmap manual page is supposed to be in section 8, but calls the .TH macro with a section argument of 5. This results in an incorrect header and causes debhelper (in Debian) to install it in the section 5 directory. Fix that. Signed-off-by: Ben Hutchings <benh@debian.org> Signed-off-by: Salvatore Bonaccorso <carnil@debian.org> Signed-off-by: Steve Dickson <steved@redhat.com>
* idmapd: Fix error status when nfs-idmapd exitsWenchao Hao2022-02-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | nfs-idmapd.service would report following error when stopped: Starting NFSv4 ID-name mapping service... rpc.idmapd[1198]: Setting log level to 0 Started NFSv4 ID-name mapping service. rpc.idmapd[1198]: exiting on signal 15 Stopping NFSv4 ID-name mapping service... nfs-idmapd.service: Main process exited, code=exited, status=1/FAILURE nfs-idmapd.service: Failed with result 'exit-code'. Stopped NFSv4 ID-name mapping service. commit 93e8f092(idmapd: Add graceful exit and resource cleanup) redirected SIGTERM, so when executing "systemctl stop nfs-idmapd", the main() of idmapd would running to tail to return, while it returned 1 which considered as error by systemd. So here just return 0 in main(). Signed-off-by: Wenchao Hao <haowenchao@huawei.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Fix Typo auto negotiating code.Richard Weinberger2022-02-221-1/+1
| | | | | | | | | | | | | | | Commit 14258541 add a check that had a '||' instead of a '&&' which is the typo. The intention of commit 14258541 was to show EBUSY errors but this error is not shown when the mount point does exists (commit afda50fc). In the end, EBUSY are now interrupted correctly in this corner case. Signed-off-by: Steve Dickson <steved@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs Fix error reporting for already mounted sharesRohan Sable2022-02-141-1/+3
| | | | | | | | | | | | | When mount is triggered for an already mounted share (using auto negotiation), it displays "mount.nfs: Protocol not supported" or "mount.nfs: access denied by server while mounting" instead of EBUSY. This easily causes confusion if the mount was not tried verbose : Signed-off-by: Rohan Sable <rsable@redhat.com> Signed-off-by: Yongcheng Yang <yoyang@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Manpages: Fix man page syntax errorsBen Hutchings2022-01-312-3/+3
| | | | | | | | | | | | | | | | | | In idmapd.conf.5, there is a line of what should be literal text beginning with ".", which makes it an (invalid) command. It can be escaped, but then there will be a space before it. Instead, Move it to the previous line and use the .BR macro so there's no space. In idmapd.man, the .I (italic) macro is used. However, this manual page uses the mdoc macro package that does not include it. Use the .Em (emphasis) macro instead. In nfsmount.conf.man, the first line should be a comment but it is actually an invalid command. Fix it to be a comment. Signed-off-by: Ben Hutchings <benh@debian.org> Signed-off-by: Salvatore Bonaccorso <carnil@debian.org> Signed-off-by: Steve Dickson <steved@redhat.com>
* exportfs: Fix left debug infoPetr Vorel2022-01-222-4/+1
| | | | | | | | | | | | Patch for 497ffdf8 ('manpage: remove the no longer supported value "vers2"') [1] didn't contain printf in exportfs.c (looks like debugging info) and errno handling in stropts.c (maybe work on other patch) which were applied. Thus removing it. [1] https://lore.kernel.org/linux-nfs/20220117031356.13361-1-yoyang@redhat.com/raw Signed-off-by: Petr Vorel <pvorel@suse.cz> Signed-off-by: Steve Dickson <steved@redhat.com>
* manpage: remove the no longer supported value "vers2"Yongcheng Yang2022-01-204-5/+5
| | | | | Signed-off-by: Yongcheng Yang <yongcheng.yang@gmail.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount: removed unused lablenfs-utils-2-5-5-rc5Steve Dickson2022-01-041-11/+0
| | | | | | | Commit f054365d removed the unnecessary bind() call but did not remove the error lable. Signed-off-by: Steve Dickson <steved@redhat.com>
* mount: Remove NFS v2 support from mount.nfsSteve Dickson2022-01-044-5/+13
| | | | | | | This patch removes the ability to do NFS v2 mounts. They will now fail with EOPNOTSUPP. Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs.man: Remove references to NFS v2 from the man pagesSteve Dickson2022-01-042-18/+4
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsd: Remove the ability to enable NFS v2.Steve Dickson2022-01-042-4/+2
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* mount: don't bind a socket needlessly.nfs-utils-2-5-5-rc4NeilBrown2021-11-101-4/+0
| | | | | | | | | | | | | | | | | | | | | When clnt_ping() calls get_socket(), get_socket() will create a socket, call bind() to choose an unused local port, and then connect to the given address. The "bind()" call is unnecessary and problematic. It is unnecessary as the "connect()" call will bind the socket as required. It is problematic as it requires a completely unused port number, rather than just a port number which isn't currently in use for connecting to the given remote address. If all local ports (net.ipv4.ip_local_port_range) are in use, the bind() will fail. However the connect() call will only fail if all those port are in use for connecting to the same address. So remove the unnecessary bind() call. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* Add --disable-sbin-override for when /sbin is a symlinkNeilBrown2021-10-252-6/+11
| | | | | | | | | | | | | | | | | | | | | | | mount.nfs* umount.nfs* and nfsdcltrack are currently always installed in /sbin. Many distros are moving to a "merged /usr" where /sbin and others are symlinks into /usr/sbin or similar. In these cases it is inelegant to install in /sbin (i.e. install through a symlink). So we add "--disable-sbin-override" as a configure option. This causes the same sbindir to be used for *mount.nfs* and nfsdcltrack as for other system binaries. Note that autotools notices if we simply define "sbindir=/sbin" inside an "if CONFIG_foo" clause, gives a warning, and defeats our intent. So instead, we use the @CONFIG_SBIN_OVERRIDE_TRUE@ prefix to find the new declaration when we don't want it. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* Move version.h into a common include directorySteve Dickson2021-09-233-3/+3
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs.man: adding new mount option max_connectOlga Kornievskaia2021-09-231-0/+13
| | | | | | | | | When client discovers trunkable servers, instead of dropping newly created trunkable connections, add this connection to the existing RPC client. Signed-off-by: Olga Kornievskaia <kolga@netapp.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: fix crash in debug message.NeilBrown2021-09-231-2/+2
| | | | | | | | | | | | | | A recent cleanup of debug messages added func and tid format specifiers to a debug message (when full hostname was different), but the func name and tid were NOT added as arguments. Consequently there weren't enough args, random bytes of the stack were interpreted as a pointer, and rpc.gssd crashed (when -v was specified). Fixes: b538862a5135 ("gssd: Cleaned up debug messages") Reviewed-by: Petr Vorel <pvorel@suse.cz> Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: Fix mem leak in mountdAlice Mitchell2021-08-211-0/+3
| | | | | | | leak of mountlist struct and content on error Signed-off-by: Alice Mitchell <ajmitchell@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: Fix mem leaks in krb5_utilAlice Mitchell2021-08-211-2/+12
| | | | | | | | | | query_krb5_ccache: if the ret_realm strdup fails then ret_princname leaks gssd_get_krb5_machine_cred_list: l was being leaked if the realloc failed it was also leaked if the strdup of ccname failed Signed-off-by: Alice Mitchell <ajmitchell@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: Fix mem leaks in gssdAlice Mitchell2021-08-211-5/+5
| | | | | | | | | ccachedir_copy isnt used properly and is leaking, ccachedir gets modified by a strtok, altering the original argv or conf parameter which is an undesirable side-effect Signed-off-by: Alice Mitchell <ajmitchell@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsdcltrack: Use uint64_t instead of time_tSteve Dickson2021-07-313-3/+3
| | | | | | | | | | | | | | With recent commits (4f2a5b64,5a53426c) that fixed compile errors on x86_64 machines, caused similar errors on i686 machines. The variable type that was being used was a time_t, which changes size between architects, which caused the compile error. Changing the variable to uint64_t fixed the issue. Signed-off-by: Steve Dickson <steved@redhat.com>
* systemd: Fix non-default statedir paths.nfs-utils-2-5-5-rc1James Hilliard2021-07-263-3/+3
| | | | | | Make the state directory configurable. Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsdcltrack/nfsdcltrack.c: Fix printf formatPetr Vorel2021-07-261-1/+2
| | | | | | | | nfsdcltrack.c: In function 'cltrack_gracedone': nfsdcltrack.c:528:47: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'time_t' {aka 'long long int'} [-Werror=format=] Signed-off-by: Petr Vorel <petr.vorel@gmail.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsdcltrack/sqlite: Fix printf formatPetr Vorel2021-07-261-1/+2
| | | | | | | | sqlite.c: In function 'sqlite_remove_unreclaimed': sqlite.c:547:71: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'time_t' {aka 'long long int'} [-Werror=format=] Signed-off-by: Petr Vorel <petr.vorel@gmail.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Fix the sloppy option processingSteve Dickson2021-07-262-3/+18
| | | | | | | | | | | | | | | | | | | The new mount API broke how the sloppy option is parsed. So the option processing needs to be moved up in the mount.nfs command. The option needs to be the first option in the string that is passed into the kernel with the -s mount(8) and/or the -o sloppy is used. Commit 92b664ef fixed the process of the -s flag and this version fixes the -o sloppy processing as well works when libmount-mount is and is not enabled plus cleans up the mount options passed to the kernel. Reviewed-and-tested-by: Dave Wysochanski <dwysocha@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: Cleaned up debug messagesnfs-utils-2-5-4-rc7Steve Dickson2021-06-105-30/+60
| | | | | | | | | Added tids to a number of statements Broke the lifetime_rec secs into a readable format Printed tids out correctly Trim down the output of both '-v' and '-vv' Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: insert 'sloppy' at beginning of the optionsJianhong Yin2021-06-103-3/+37
| | | | | | | | | | | | Previously, the 'sloppy' option was appended to other options so that when kernel parses the options sequentially, the 'sloppy' option will not work if there's a invalid option in front of it. use 'po_insert' instead 'po_append' Signed-off-by: Jianhong Yin <yin-jianhong@163.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs(5): Correct the spelling of "kernel_source"Chuck Lever2021-06-101-1/+1
| | | | | Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs(5): Fix missing mentions of "rdma6" netidChuck Lever2021-06-101-2/+2
| | | | | Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: add timeout for upcall threadsnfs-utils-2-5-4-rc6Steve Dickson2021-06-104-29/+340
| | | | | | | | | | | | | | | | Add a global list of active upcalls and a watchdog thread that walks the list, looking for threads running longer than timeout seconds. By default, an error message will by logged to the syslog. The upcall timeout can be specified by passing the -U option or by setting the upcall-timeout parameter in nfs.conf. Passing the -C option or setting cancel-timed-out-upcalls=1 in nfs.conf causes the watchdog thread to also cancel timed-out upcall threads and report an error of -ETIMEDOUT to the kernel. Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: deal with failed thread creationScott Mayhew2021-06-103-118/+164
| | | | | | | | | | | | | | If we fail to create a thread to handle an upcall, we still need to do a downcall to tell the kernel about the failure, otherwise the process that is trying to establish gss credentials will hang. This patch shifts the thread creation down a level in the call chain so now the main thread does a little more work up front (reading & parsing the data from the pipefs file) so it has the info it needs to be able to do the error downcall. Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>