Recent Linux NFS uses a simulated attibute cache change detection
authorzoulasc <christos@zoulas.com>
Thu, 3 Mar 2016 18:18:21 +0000 (13:18 -0500)
committerzoulasc <christos@zoulas.com>
Thu, 3 Mar 2016 18:18:21 +0000 (13:18 -0500)
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.

From: Ian Kent

amd/autil.c

index cd9514d44ef4b76079c06833d017979729a3f327..efd18ef4202f1f03ed41a91d1c2c779c51dbd95e 100644 (file)
@@ -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);