]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
* Apply patch from Chas Williams to fix stale cache data from deleted
authorRuss Allbery <rra@debian.org>
Wed, 11 May 2005 04:06:36 +0000 (04:06 +0000)
committerRuss Allbery <rra@debian.org>
Wed, 11 May 2005 04:06:36 +0000 (04:06 +0000)
    files introduced in 1.3.82.

debian/changelog
debian/patch.stale-cache [new file with mode: 0644]
src/afs/LINUX/osi_vnodeops.c

index 8514a4885cf2d1e1b69c1a4e7d6c0fdbeb0fba31..0051e522c07f3a21f044c0192c671b315ee98201 100644 (file)
@@ -4,6 +4,8 @@ openafs (1.3.82-1) unstable; urgency=low
     - Proper locking for preempt kernels.  This bug manifested as an
       inability to shut down AFS cleanly.  (Closes: #308399, #304040)
     - Correctly handle the inotify semaphore.  (Closes: #303495)
+  * Apply patch from Chas Williams to fix stale cache data from deleted
+    files introduced in 1.3.82.
   * In all cases, only build the module appropriate to the kernel we're
     building against.  Building an SMP module against a non-SMP kernel
     fails due to missing defines.  (Closes: #225907)
diff --git a/debian/patch.stale-cache b/debian/patch.stale-cache
new file mode 100644 (file)
index 0000000..3158d7e
--- /dev/null
@@ -0,0 +1,74 @@
+Patch from Chas Williams <chas@cmf.nrl.navy.mil> posted to
+openafs-devel@openafs.org on 2005-05-05.  Chances are very high that
+this will be in 1.3.83, so check again then.  Fixes a bug introduced
+in 1.3.82.
+
+--- src/afs/LINUX/osi_vnodeops.c.orig  2005-04-25 10:55:47.000000000 -0400
++++ src/afs/LINUX/osi_vnodeops.c       2005-05-05 09:28:26.000000000 -0400
+@@ -867,7 +867,7 @@
+     cred_t *credp = NULL;
+     struct vrequest treq;
+     int code, bad_dentry;
+-    struct vcache *vcp, *parentvcp;
++    struct vcache *vcp, *pvcp;
+ #ifdef AFS_LINUX24_ENV
+     lock_kernel();
+@@ -875,14 +875,20 @@
+     AFS_GLOCK();
+     vcp = ITOAFS(dp->d_inode);
+-    parentvcp = ITOAFS(dp->d_parent->d_inode);                /* dget_parent()? */
++    pvcp = ITOAFS(dp->d_parent->d_inode);             /* dget_parent()? */
+     /* If it's a negative dentry, it's never valid */
+-    if (!vcp || !parentvcp) {
++    if (!vcp || !pvcp) {
+       bad_dentry = 1;
+       goto done;
+     }
++    /* parent's DataVersion changed? */
++    if (hgetlo(pvcp->m.DataVersion) > dp->d_time) {
++      bad_dentry = 11;
++      goto done;
++    }
++
+     /* If it's @sys, perhaps it has been changed */
+     if (!afs_ENameOK(dp->d_name.name)) {
+       bad_dentry = 10;
+@@ -1024,6 +1030,7 @@
+ #endif
+       dp->d_op = &afs_dentry_operations;
++      dp->d_time = hgetlo(ITOAFS(dip)->m.DataVersion);
+       d_instantiate(dp, ip);
+     }
+@@ -1095,6 +1102,7 @@
+ #endif
+     }
+     dp->d_op = &afs_dentry_operations;
++    dp->d_time = hgetlo(ITOAFS(dip)->m.DataVersion);
+     d_add(dp, AFSTOI(vcp));
+ #if defined(AFS_LINUX26_ENV)
+@@ -1185,8 +1193,10 @@
+       }
+       AFS_GUNLOCK();
+-      if (!code)
++      if (!code) {
++          __dp->d_time = hgetlo(ITOAFS(dip)->m.DataVersion);
+           d_move(dp, __dp);
++      }
+       dput(__dp);
+       goto out;
+@@ -1252,6 +1262,7 @@
+       tvcp->v.v_fop = &afs_dir_fops;
+ #endif
+       dp->d_op = &afs_dentry_operations;
++      dp->d_time = hgetlo(ITOAFS(dip)->m.DataVersion);
+       d_instantiate(dp, AFSTOI(tvcp));
+     }
index 0ea0955c306d46046618fe45037421841d6240de..1dea67fe21bd40a793383d933e87ac29809aa974 100644 (file)
@@ -867,7 +867,7 @@ afs_linux_dentry_revalidate(struct dentry *dp)
     cred_t *credp = NULL;
     struct vrequest treq;
     int code, bad_dentry;
-    struct vcache *vcp, *parentvcp;
+    struct vcache *vcp, *pvcp;
 
 #ifdef AFS_LINUX24_ENV
     lock_kernel();
@@ -875,14 +875,20 @@ afs_linux_dentry_revalidate(struct dentry *dp)
     AFS_GLOCK();
 
     vcp = ITOAFS(dp->d_inode);
-    parentvcp = ITOAFS(dp->d_parent->d_inode);         /* dget_parent()? */
+    pvcp = ITOAFS(dp->d_parent->d_inode);              /* dget_parent()? */
 
     /* If it's a negative dentry, it's never valid */
-    if (!vcp || !parentvcp) {
+    if (!vcp || !pvcp) {
        bad_dentry = 1;
        goto done;
     }
 
+    /* parent's DataVersion changed? */
+    if (hgetlo(pvcp->m.DataVersion) > dp->d_time) {
+       bad_dentry = 11;
+       goto done;
+    }
+
     /* If it's @sys, perhaps it has been changed */
     if (!afs_ENameOK(dp->d_name.name)) {
        bad_dentry = 10;
@@ -1024,6 +1030,7 @@ afs_linux_create(struct inode *dip, struct dentry *dp, int mode)
 #endif
 
        dp->d_op = &afs_dentry_operations;
+       dp->d_time = hgetlo(ITOAFS(dip)->m.DataVersion);
        d_instantiate(dp, ip);
     }
 
@@ -1095,6 +1102,7 @@ afs_linux_lookup(struct inode *dip, struct dentry *dp)
 #endif
     }
     dp->d_op = &afs_dentry_operations;
+    dp->d_time = hgetlo(ITOAFS(dip)->m.DataVersion);
     d_add(dp, AFSTOI(vcp));
 
 #if defined(AFS_LINUX26_ENV)
@@ -1185,8 +1193,10 @@ afs_linux_unlink(struct inode *dip, struct dentry *dp)
        }
        AFS_GUNLOCK();
 
-       if (!code)
+       if (!code) {
+           __dp->d_time = hgetlo(ITOAFS(dip)->m.DataVersion);
            d_move(dp, __dp);
+       }
        dput(__dp);
 
        goto out;
@@ -1252,6 +1262,7 @@ afs_linux_mkdir(struct inode *dip, struct dentry *dp, int mode)
        tvcp->v.v_fop = &afs_dir_fops;
 #endif
        dp->d_op = &afs_dentry_operations;
+       dp->d_time = hgetlo(ITOAFS(dip)->m.DataVersion);
        d_instantiate(dp, AFSTOI(tvcp));
     }