]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
LINUX: Avoid infinite d_invalidate loop
authorAndrew Deason <adeason@sinenomine.net>
Thu, 13 Dec 2012 22:36:20 +0000 (16:36 -0600)
committerStephan Wiesand <stephan.wiesand@desy.de>
Fri, 21 Dec 2012 18:43:12 +0000 (10:43 -0800)
If a reference is grabbed after we d_invalidate() a dentry, but before
we dput() that dentry, the dentry can still be on the alias list for
its inode. This will cause us to loop forever, since we'll get the
same dentry back from d_find_alias, and d_invalidate() will return
success, since it is a no-op.

Avoid this by just limiting the number of times we loop. Leaving
dentry aliases around is non-critical as long as we clear some each
time.

This change is not applicable to master, which will get a more robust
fix for this issue. This change was discussed during the 19 Dec 2012
release-team meeting.

Change-Id: Ief22ae9f8f6de62518604383c421772c25c5dc26
Reviewed-on: http://gerrit.openafs.org/8795
Reviewed-by: Paul Smeddle <paul.smeddle@gmail.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
src/afs/LINUX/osi_vnodeops.c
src/afs/LINUX24/osi_vnodeops.c

index 1344d0ca0c82f1be8626144150ef6bcbd6c3cab6..1366b9637bee3104d310f7f7c835261c08fcaa6b 100644 (file)
@@ -1294,8 +1294,9 @@ afs_linux_lookup(struct inode *dip, struct dentry *dp)
     if (ip && S_ISDIR(ip->i_mode)) {
        int retry = 1;
        struct dentry *alias;
+       int safety;
 
-       while (retry) {
+       for (safety = 0; retry && safety < 64; safety++) {
            retry = 0;
 
            /* Try to invalidate an existing alias in favor of our new one */
index 87f7e37aad2289c630afa21b07a4d261f3fb69dd..6c0589b76c82fd305dc92316b6032fddf92dbdb5 100644 (file)
@@ -1304,8 +1304,9 @@ afs_linux_lookup(struct inode *dip, struct dentry *dp)
     if (ip && S_ISDIR(ip->i_mode)) {
        int retry = 1;
        struct dentry *alias;
+       int safety;
 
-       while (retry) {
+       for (safety = 0; retry && safety < 64; safety++) {
            retry = 0;
 
            /* Try to invalidate an existing alias in favor of our new one */