- update to official version 6.2 source plus add bug fixes for the internal NFSv3 server.

This commit is contained in:
Ian Kent 2015-12-30 16:56:36 +08:00
parent 634a5ca07b
commit 288b05ec10
10 changed files with 365 additions and 772 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ am-utils-6.1.5.tar.gz
*.log
*.rpm
/am-utils-6.2.0-1.git.bb13dea6.tar.gz
/am-utils-6.2.tar.gz

View File

@ -0,0 +1,25 @@
am-utils-6.2 - add debug log trace to NFSv3 readdirplus
From: Ian Kent <raven@themaw.net>
Add log trace print to NFSv3 readdirplus for debuging purposes.
Signed-off-by: Ian Kent <raven@themaw.net>
---
amd/nfs_subr.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/amd/nfs_subr.c b/amd/nfs_subr.c
index 30effba..ef07a4a 100644
--- a/amd/nfs_subr.c
+++ b/amd/nfs_subr.c
@@ -1642,6 +1642,9 @@ am_nfs3_readdirplus_3_svc(am_READDIRPLUS3args *argp, struct svc_req *rqstp)
am_node *mp;
int retry;
+ if (amuDebug(D_TRACE))
+ plog(XLOG_DEBUG, "readdirplus_3:");
+
mp = fh3_to_mp3(dir, &retry, VLOOK_CREATE);
if (mp == NULL) {
if (retry < 0) {

View File

@ -0,0 +1,32 @@
am-utils-6.2 - fix NFSv3 access method return on non-existent mount point
From: Ian Kent <raven@themaw.net>
When the NFS v3 access method is called and there is no mount point
corresponding to the path ESTALE needs to be returned the kernel NFS
client so an NFS lookup will be done and the mount point re-mounted.
If there is no map entry to mount the NFS v3 lookup method can then
return the failure.
Signed-off-by: Ian Kent <raven@themaw.net>
---
amd/nfs_subr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/amd/nfs_subr.c b/amd/nfs_subr.c
index ef07a4a..85cf98c 100644
--- a/amd/nfs_subr.c
+++ b/amd/nfs_subr.c
@@ -1239,9 +1239,9 @@ am_nfs3_access_3_svc(am_ACCESS3args *argp, struct svc_req *rqstp)
if (!mp) {
post_op_obj = &result.res_u.fail.obj_attributes;
post_op_obj->attributes_follow = 0;
- result.status = nfs_error(ENOENT);
+ result.status = nfs_error(ESTALE);
if (amuDebug(D_TRACE))
- plog(XLOG_DEBUG, "access_3: ENOENT");
+ plog(XLOG_DEBUG, "access_3: ESTALE");
} else {
nfsfattr *fattr = &mp->am_fattr;
am_fattr3 *fattr3;

View File

@ -0,0 +1,76 @@
am-utils-6.2 - fix NFSv3 lookup dir attribute return value
From: Ian Kent <raven@themaw.net>
The NFS v3 lookup method, which returns attributes for the directory
containing the object to be looked up, used incorrect mount point
attributes which was causing unusual file system object visibility
problems.
Signed-off-by: Ian Kent <raven@themaw.net>
---
amd/nfs_subr.c | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/amd/nfs_subr.c b/amd/nfs_subr.c
index 85cf98c..6a1b717 100644
--- a/amd/nfs_subr.c
+++ b/amd/nfs_subr.c
@@ -978,6 +978,29 @@ static void fattr_to_wcc_attr(nfsfattr *fattr, am_wcc_attr *wcc_attr)
nfstime_to_am_nfstime3(&fattr->na_ctime, &wcc_attr->ctime);
}
+static nfsfattr *get_parent_fattr(am_node *mp)
+{
+ nfsfattr *fattr;
+
+ /* Set attributes to those of the parent only if this
+ * isn't topvol otherwise just use the mp attributes.
+ */
+ fattr = &mp->am_fattr;
+ if (mp->am_parent && mp->am_parent->am_parent &&
+ !(mp->am_parent->am_parent->am_flags & AMF_ROOT))
+ fattr = &mp->am_parent->am_fattr;
+
+ return fattr;
+}
+
+static void parent_fattr_to_fattr3(am_node *mp, am_fattr3 *fattr3)
+{
+ nfsfattr *fattr;
+
+ fattr = get_parent_fattr(mp);
+ fattr_to_fattr3(fattr, fattr3);
+}
+
static am_nfsstat3 return_estale_or_rofs(am_nfs_fh3 *fh,
am_pre_op_attr *pre_op,
am_post_op_attr *post_op)
@@ -1177,9 +1200,7 @@ am_nfs3_lookup_3_svc(am_LOOKUP3args *argp, struct svc_req *rqstp)
/* dir attributes */
post_op_dir->attributes_follow = 1;
- fattr = &mp->am_fattr;
fattr3 = &post_op_dir->am_post_op_attr_u.attributes;
- fattr_to_fattr3(fattr, fattr3);
post_op_obj->attributes_follow = 0;
@@ -1196,6 +1217,7 @@ am_nfs3_lookup_3_svc(am_LOOKUP3args *argp, struct svc_req *rqstp)
amd_stats.d_drops++;
return 0;
}
+ parent_fattr_to_fattr3(mp, fattr3);
result.status = nfs_error(error);
} else {
/*
@@ -1206,6 +1228,9 @@ am_nfs3_lookup_3_svc(am_LOOKUP3args *argp, struct svc_req *rqstp)
if (ap->am_ttl < mp->am_ttl)
ap->am_ttl = mp->am_ttl;
+ /* dir attrs, update after mount */
+ parent_fattr_to_fattr3(mp, fattr3);
+
mp_to_fh3(ap, &result.res_u.ok.object);
/* mount attributes */

View File

@ -0,0 +1,53 @@
am-utils-6.2 - fix NFSv3 readdir post_op_dir attributes return
From: Ian Kent <raven@themaw.net>
The NFS v3 readdir method is expected to return the attributes of
the directory being read for both success and fail cases.
Signed-off-by: Ian Kent <raven@themaw.net>
---
amd/nfs_subr.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/amd/nfs_subr.c b/amd/nfs_subr.c
index 6a1b717..00a1dc0 100644
--- a/amd/nfs_subr.c
+++ b/amd/nfs_subr.c
@@ -1627,28 +1627,29 @@ am_nfs3_readdir_3_svc(am_READDIR3args *argp, struct svc_req *rqstp)
result.status = nfs_error(retry);
} else {
am_dirlist3 *list = &result.res_u.ok.reply;
+ nfsfattr *fattr;
+ am_fattr3 *fattr3;
am_nfsstat3 status;
if (amuDebug(D_TRACE))
plog(XLOG_DEBUG, "\treaddir_3(%s)", mp->am_path);
+ fattr = &mp->am_fattr;
+
status = mp->am_al->al_mnt->mf_ops->readdir(mp,
(voidp)&cookie, list, entries, count);
if (status == 0) {
post_op_dir = &result.res_u.ok.dir_attributes;
- nfsfattr *fattr;
- am_fattr3 *fattr3;
-
- fattr = &mp->am_fattr;
- fattr3 = &post_op_dir->am_post_op_attr_u.attributes;
post_op_dir->attributes_follow = 1;
- fattr_to_fattr3(fattr, fattr3);
+ fattr3 = &post_op_dir->am_post_op_attr_u.attributes;
result.status = AM_NFS3_OK;
} else {
post_op_dir = &result.res_u.fail.dir_attributes;
- post_op_dir->attributes_follow = 0;
+ post_op_dir->attributes_follow = 1;
+ fattr3 = &post_op_dir->am_post_op_attr_u.attributes;
result.status = nfs_error(status);
}
+ fattr_to_fattr3(fattr, fattr3);
mp->am_stats.s_readdir++;
}

View File

@ -0,0 +1,62 @@
am-utils-6.2 - fix NFSv3 unlink3_or_rmdir3() post_op attributes return
From: Ian Kent <raven@themaw.net>
The function unlink3_or_rmdir3() is called by both NFS v3 remove and
rmdir methods. Both of these methods require post op wcc attributes
to be returned but unlink3_or_rmdir3() was returning only the pre op
wcc attributes.
Signed-off-by: Ian Kent <raven@themaw.net>
---
amd/nfs_subr.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/amd/nfs_subr.c b/amd/nfs_subr.c
index 00a1dc0..0a43b98 100644
--- a/amd/nfs_subr.c
+++ b/amd/nfs_subr.c
@@ -1033,7 +1033,7 @@ static am_nfsstat3 unlink3_or_rmdir3(am_diropargs3 *argp,
am_pre_op_attr *pre_op_dir = &wcc_data->before;
am_post_op_attr *post_op_dir = &wcc_data->after;
nfsfattr *fattr;
- am_wcc_attr *wcc_attr;
+ am_wcc_attr *pre_op_wcc_attr, *post_op_wcc_attr;
am_node *mp, *ap;
int retry;
@@ -1050,12 +1050,17 @@ static am_nfsstat3 unlink3_or_rmdir3(am_diropargs3 *argp,
goto out;
}
+ post_op_dir->attributes_follow = 1;
+ post_op_wcc_attr = &post_op_dir->am_post_op_attr_u.attributes;
+
pre_op_dir->attributes_follow = 1;
+ pre_op_wcc_attr = &pre_op_dir->am_pre_op_attr_u.attributes;
+
fattr = &mp->am_fattr;
- wcc_attr = &pre_op_dir->am_pre_op_attr_u.attributes;
- fattr_to_wcc_attr(fattr, wcc_attr);
+ fattr_to_wcc_attr(fattr, pre_op_wcc_attr);
if (mp->am_fattr.na_type != NFDIR) {
+ fattr_to_wcc_attr(fattr, post_op_wcc_attr);
res = nfs_error(ENOTDIR);
goto out;
}
@@ -1075,9 +1080,14 @@ static am_nfsstat3 unlink3_or_rmdir3(am_diropargs3 *argp,
*/
else if (retry == ENOENT)
retry = 0;
+ fattr_to_wcc_attr(fattr, post_op_wcc_attr);
res = nfs_error(retry);
} else {
forcibly_timeout_mp(mp);
+ /* we can't wait for the expire so use the attributes as
+ * they are now for the post op wcc attributes.
+ */
+ fattr_to_wcc_attr(fattr, post_op_wcc_attr);
res = AM_NFS3_OK;
}

View File

@ -1,36 +0,0 @@
diff -up am-utils-6.2.0-1.git.bb13dea6/bootstrap.orig am-utils-6.2.0-1.git.bb13dea6/bootstrap
--- am-utils-6.2.0-1.git.bb13dea6/bootstrap.orig 2014-10-21 05:42:37.128509523 -0400
+++ am-utils-6.2.0-1.git.bb13dea6/bootstrap 2014-10-21 05:51:38.044996707 -0400
@@ -59,13 +59,13 @@ fi
echo "AMU: Fixing ylwrap..."
patch << \EOF
---- ylwrap.orig 2014-05-08 21:18:30.000000000 -0400
-+++ ylwrap 2014-05-09 22:25:54.900240000 -0400
-@@ -153,6 +153,22 @@
- *[\\/]*) prog="`pwd`/$prog" ;;
+--- ylwrap.orig 2014-10-21 05:38:42.210204684 -0400
++++ ylwrap 2014-10-21 05:44:45.602138698 -0400
+@@ -161,6 +161,22 @@
+ *[\\/]*) prog=`pwd`/$prog ;;
esac
-+prefix=`echo $input | sed \
++prefix=`echo $input | sed \
+ -e 's,^.*/,,g' \
+ -e 's/_gram.[yl]$/_/g' \
+ -e 's/_lex.[yl]$/_/g' \
@@ -81,10 +81,10 @@ patch << \EOF
+ flags="-p $prefix";;
+esac
+
- # FIXME: add hostname here for parallel makes that run commands on
- # other machines. But that might take us over the 14-char limit.
dirname=ylwrap$$
-@@ -166,10 +182,13 @@
+ do_exit="cd '`pwd`' && rm -rf $dirname > /dev/null 2>&1;"' (exit $ret); exit $ret'
+ trap "ret=129; $do_exit" 1
+@@ -172,10 +188,13 @@
cd $dirname
case $# in

View File

@ -1,17 +1,14 @@
Summary: Automount utilities including an updated version of Amd
Name: am-utils
Version: 6.2.0
%define githash bb13dea6d0bf378f38a2a009a9802577f5399673
%define shorthash %(echo "%{githash}" | cut -c -8)
%define gitdate 20140906
%define revision 1
Release: 4.%{gitdate}git%{shorthash}%{?dist}
%define upstream_version 6.2
Release: 5%{?dist}
License: BSD
Epoch: 5
Group: System Environment/Daemons
URL: http://am-utils.org
# Git repository git://git.fsl.cs.sunysb.edu/am-utils-6.2.git
Source: am-utils-%{version}-%{revision}.git.%{shorthash}.tar.gz
Source: ftp://ftp.am-utils.org/pub/am-utils/am-utils-%{upstream_version}.tar.gz
Source1: amd.service
Source2: am-utils.conf
Source3: am-utils.sysconf
@ -28,7 +25,6 @@ BuildRequires: flex
BuildRequires: tcp_wrappers-devel
BuildRequires: systemd-units
BuildRequires: texinfo
BuildRequires: perl-Unicode-EastAsianWidth
BuildRequires: gcc
BuildRequires: m4
@ -45,11 +41,14 @@ Requires(preun): systemd-units
Requires(postun): systemd-units
Requires(preun): /sbin/install-info
# automake ylwrap has changed, fix inline patch in bootstrap.
Patch1: am-utils-6.2.0-1.git.bb13dea6-ylwrap.patch
# Fix problems with possible future libtool rebases (#1181698)
Patch2: am-utils-6.2.0-1.git.bb13dea6-dont-include-auto-generated-macros-in-aclinlude_m4.patch
Patch1: am-utils-6.2-dont-include-auto-generated-macros-in-aclinlude_m4.patch
Patch2: am-utils-6.2-add-debug-log-trace-to-NFSv3-readdirplus.patch
Patch3: am-utils-6.2-fix-NFSv3-access-method-return-on-non-existent-mount-point.patch
Patch4: am-utils-6.2-fix-NFSv3-lookup-dir-attribute-return-value.patch
Patch5: am-utils-6.2-fix-NFSv3-readdir-post_op_dir-attributes-return.patch
Patch6: am-utils-6.2-fix-NFSv3-unlink3_or_rmdir3-post_op-attributes-return.patch
# Not needed since autoreconf/libtool appear to do this automatically
# Leaving it set doesn't appear to be a problem so leave it set in
@ -72,10 +71,14 @@ You should install am-utils if you need a program for automatically
mounting and unmounting filesystems.
%prep
%setup -q -n %{name}-%{version}-%{revision}.git.%{shorthash}
%setup -q -n %{name}-%{upstream_version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
./bootstrap
@ -87,7 +90,8 @@ chmod +x find-requires
%configure \
--enable-shared \
--enable-am-cflags="-DHAVE_LINUX_NFS_MOUNT_H" \
--enable-libs="-lnsl -lresolv"
--enable-libs="-lnsl -lresolv" \
--enable-debug
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
@ -186,6 +190,21 @@ fi
%{_libdir}/libamu.so*
%changelog
* Thu Dec 17 2015 Fedora Release Engineering <ikent@redhat.com> - 5:6.2.0-5
- update to upstream source release 6.2.
- use starting revision 5 to ensure package will update from previous package.
- add configure option enable-debug so we can get logs of any problems with
the new amd NFS v3 service.
- remove BuildRequires: perl-Unicode-EastAsianWidth.
- move libtool macro functions from m4/macros to m4 and delete.
- add debug log trace to NFSv3 readdirplus
- fix NFSv3 access method return on non-existent mount point.
- fix NFSv3 lookup dir attribute return value.
- fix NFSv3 readdir post_op_dir attributes return.
- fix NFSv3 unlink3_or_rmdir3() post_op attributes return.
- fix mtime update on NFSv3 lookup.
* Tue Jun 16 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5:6.2.0-4.20140906gitbb13dea6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

View File

@ -1 +1 @@
6f631a68f7d98eca36feb5d675ff2296 am-utils-6.2.0-1.git.bb13dea6.tar.gz
4b2ada9cadd24f8a231601274d6fb036 am-utils-6.2.tar.gz