Re: [PATCH] autofs4 doesn't expire

From: Andrew Morton (akpm@osdl.org)
Date: Tue Aug 05 2003 - 18:49:04 EST


spam@streefland.xs4all.nl (Dick Streefland) wrote:
>
> In linux-2.6.0-test1, lookup_mnt() was changed to increment the ref
> count of the returned vfsmount struct. This breaks expiration of
> autofs4 mounts, because lookup_mnt() is called in check_vfsmnt()
> without decrementing the ref count afterwards. The following patch
> fixes this:
>

Neat, thanks.

Probably we should hold onto that ref because we play with the vfsmount
later on. So something like this?

diff -puN fs/autofs4/expire.c~autofs4-expiry-fix fs/autofs4/expire.c
--- 25/fs/autofs4/expire.c~autofs4-expiry-fix 2003-08-05 16:44:41.000000000 -0700
+++ 25-akpm/fs/autofs4/expire.c 2003-08-05 16:48:20.000000000 -0700
@@ -25,7 +25,7 @@ static inline int is_vfsmnt_tree_busy(st
         struct list_head *next;
         int count;
 
- count = atomic_read(&mnt->mnt_count) - 1;
+ count = atomic_read(&mnt->mnt_count) - 1 - 1;
 
 repeat:
         next = this_parent->mnt_mounts.next;
@@ -70,8 +70,11 @@ static int check_vfsmnt(struct vfsmount
         int ret = dentry->d_mounted;
         struct vfsmount *vfs = lookup_mnt(mnt, dentry);
 
- if (vfs && is_vfsmnt_tree_busy(vfs))
- ret--;
+ if (vfs) {
+ if (is_vfsmnt_tree_busy(vfs))
+ ret = 0;
+ mntput(vfs);
+ }
         DPRINTK(("check_vfsmnt: ret=%d\n", ret));
         return ret;
 }

_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Aug 07 2003 - 22:00:30 EST