- fix Linux NFS recognition of umounts and add systemd dependency on nfs-lock.service.

This commit is contained in:
Ian Kent 2016-02-29 16:26:12 +08:00
parent cafd3ce99f
commit 41f4e18791
3 changed files with 48 additions and 2 deletions

View File

@ -0,0 +1,39 @@
am-utils-6.2 - fix Linux NFS recognition of umounts
From: Ian Kent <raven@themaw.net>
Recent Linux NFS uses a simulated attibute cache change detection
method based on ctime. Consequenty the amd use of mtime for this
doesn't work properly for some kernel versions.
The problem seen with some kernel versions is a failure to recognize
umounts.
Updating the parent ctime in step with mtime during umount appears
to fix the problem.
Signed-off-by: Ian Kent <raven@themaw.net>
---
amd/autil.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/amd/autil.c b/amd/autil.c
index cd9514d..efd18ef 100644
--- a/amd/autil.c
+++ b/amd/autil.c
@@ -709,10 +709,13 @@ am_unmounted(am_node *mp)
--mp->am_parent->am_fattr.na_nlink;
/*
- * Update mtime of parent node
+ * Update mtime and ctime of parent node (as ctime is needed for some
+ * Linux NFS kernel versions to properly recognize attribute changes).
*/
- if (mp->am_parent && mp->am_parent->am_al->al_mnt)
+ if (mp->am_parent && mp->am_parent->am_al->al_mnt) {
clocktime(&mp->am_parent->am_fattr.na_mtime);
+ mp->am_parent->am_fattr.na_ctime = mp->am_parent->am_fattr.na_mtime;
+ }
if (mp->am_parent && (mp->am_flags & AMF_REMOUNT)) {
char *fname = xstrdup(mp->am_name);

View File

@ -2,7 +2,7 @@ Summary: Automount utilities including an updated version of Amd
Name: am-utils
Version: 6.2.0
%define upstream_version 6.2
Release: 9%{?dist}
Release: 10%{?dist}
License: BSD
Epoch: 5
Group: System Environment/Daemons
@ -50,6 +50,8 @@ 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
Patch7: am-utils-6.2-fix-Linux-NFS-recognition-of-umounts.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
# case this changes.
@ -79,6 +81,7 @@ mounting and unmounting filesystems.
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
./bootstrap
@ -190,6 +193,10 @@ fi
%{_libdir}/libamu.so*
%changelog
* Mon Feb 29 2016 Ian Kent <ikent@redhat.com> - 5:6.2.0-10
- fix Linux NFS recognition of umounts.
- add systemd dependency on nfs-lock.service.
* Tue Feb 2 2016 Ian Kent <ikent@redhat.com> - 5:6.2.0-9
- Update Requires: portmap to Requires: rpcbind.

View File

@ -1,7 +1,7 @@
[Unit]
Description=automount daemon that mounts devices and NFS hosts on demand
After=syslog.target network.target network-online.target rpcbind.service
Wants=network-online.target rpcbind.service
Wants=network-online.target rpcbind.service nfs-lock.service
[Service]
EnvironmentFile=-/etc/sysconfig/amd