import CS nfs-utils-2.5.4-20.el9

This commit is contained in:
eabdullin 2023-09-21 19:38:41 +00:00
parent e8fbc87c3b
commit 33e2b10357
3 changed files with 106 additions and 1 deletions

View File

@ -0,0 +1,69 @@
commit cdbef4e97a1cbc68cbaf16ba57d71858d2c69973
Author: Jeff Layton <jlayton@kernel.org>
Date: Tue Jan 10 09:37:25 2023 -0500
nfs-utils: Don't allow junction tests to trigger automounts
JianHong reported some strange behavior with automounts on an nfs server
without an explicit pseudoroot. When clients issued a readdir in the
pseudoroot, automounted directories that were not yet mounted would show
up even if they weren't exported, though the clients wouldn't be able to
do anything with them.
The issue was that triggering the automount on a directory would cause
the mountd upcall to time out, which would cause nfsd to include the
automounted dentry in the readdir response. Eventually, the automount
would work and report that it wasn't exported and subsequent attempts to
access the dentry would (properly) fail.
We never want mountd to trigger an automount. The kernel should do that
if it wants to use it. Change the junction checks to do an O_PATH open
and use fstatat with AT_NO_AUTOMOUNT.
Cc: Chuck Lever <chuck.lever@oracle.com>
Link: https://bugzilla.redhat.com/show_bug.cgi?id=2148353
Link: https://bugzilla.kernel.org/show_bug.cgi?id=216777
Reported-by: JianHong Yin <jiyin@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/support/junction/junction.c b/support/junction/junction.c
index 41cce26..0628bb0 100644
--- a/support/junction/junction.c
+++ b/support/junction/junction.c
@@ -93,7 +93,7 @@ junction_is_directory(int fd, const char *path)
{
struct stat stb;
- if (fstat(fd, &stb) == -1) {
+ if (fstatat(fd, "", &stb, AT_NO_AUTOMOUNT|AT_EMPTY_PATH) == -1) {
xlog(D_GENERAL, "%s: failed to stat %s: %m",
__func__, path);
return FEDFS_ERR_ACCESS;
@@ -121,7 +121,7 @@ junction_is_sticky_bit_set(int fd, const char *path)
{
struct stat stb;
- if (fstat(fd, &stb) == -1) {
+ if (fstatat(fd, "", &stb, AT_NO_AUTOMOUNT|AT_EMPTY_PATH) == -1) {
xlog(D_GENERAL, "%s: failed to stat %s: %m",
__func__, path);
return FEDFS_ERR_ACCESS;
@@ -155,7 +155,7 @@ junction_set_sticky_bit(int fd, const char *path)
{
struct stat stb;
- if (fstat(fd, &stb) == -1) {
+ if (fstatat(fd, "", &stb, AT_NO_AUTOMOUNT|AT_EMPTY_PATH) == -1) {
xlog(D_GENERAL, "%s: failed to stat %s: %m",
__func__, path);
return FEDFS_ERR_ACCESS;
@@ -393,7 +393,7 @@ junction_get_mode(const char *pathname, mode_t *mode)
if (retval != FEDFS_OK)
return retval;
- if (fstat(fd, &stb) == -1) {
+ if (fstatat(fd, "", &stb, AT_NO_AUTOMOUNT|AT_EMPTY_PATH) == -1) {
xlog(D_GENERAL, "%s: failed to stat %s: %m",
__func__, pathname);
(void)close(fd);

View File

@ -0,0 +1,23 @@
diff -up nfs-utils-2.5.4/systemd/nfs.conf.man.orig nfs-utils-2.5.4/systemd/nfs.conf.man
--- nfs-utils-2.5.4/systemd/nfs.conf.man.orig 2023-06-06 09:51:19.931377748 -0400
+++ nfs-utils-2.5.4/systemd/nfs.conf.man 2023-06-06 11:21:47.490616649 -0400
@@ -131,8 +131,9 @@ but on the server, this will resolve to
.TP
.B exportd
Recognized values:
+.BR manage-gids ,
.BR threads ,
-.BR cache-use-upaddr ,
+.BR cache-use-ipaddr ,
.BR ttl ,
.BR state-directory-path
@@ -197,7 +198,7 @@ Recognized values:
.BR port ,
.BR threads ,
.BR reverse-lookup ,
-.BR cache-use-upaddr ,
+.BR cache-use-ipaddr ,
.BR ttl ,
.BR state-directory-path ,
.BR ha-callout .

View File

@ -2,7 +2,7 @@ Summary: NFS utilities and supporting clients and daemons for the kernel NFS ser
Name: nfs-utils
URL: http://linux-nfs.org/
Version: 2.5.4
Release: 18%{?dist}
Release: 20%{?dist}
Epoch: 1
# group all 32bit related archs
@ -42,6 +42,12 @@ Patch014: nfs-utils-2.5.4-mount-null-ptr.patch
Patch015: nfs-utils-2.5.4-nfsrahead-cmd.patch
Patch016: nfs-utils-2.5.4-covscan-return-value.patch
#
# RHEL9.3
#
Patch017: nfs-utils-2.5.4-juncs-automount.patch
Patch018: nfs-utils-2.5.4-man-nfsconf.patch
Patch100: nfs-utils-1.2.1-statdpath-man.patch
Patch101: nfs-utils-1.2.1-exp-subtree-warn-off.patch
Patch102: nfs-utils-1.2.5-idmap-errmsg.patch
@ -482,6 +488,13 @@ fi
%{_mandir}/*/nfsiostat.8.gz
%changelog
* Mon Aug 7 2023 Steve Dickson <steved@redhat.com> 2.5.4-20
- Fixed a regression in the junction code (bz 2213669)
* Tue Jun 6 2023 Steve Dickson <steved@redhat.com> 2.5.4-19
- Don't allow junction tests to trigger automounts (bz 2148353)
- Fix typo in man page nfs.conf.man (bz 2203092)
* Thu Jan 26 2023 Steve Dickson <steved@redhat.com> 2.5.4-18
- Covscan Scan: Wrong Check of Return Value (bz 2151968)