aboutsummaryrefslogtreecommitdiffstats
path: root/fs/autofs4/autofs_i.h
diff options
context:
space:
mode:
authorIan Kent <raven@themaw.net>2008-07-24 00:30:26 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-24 13:47:32 -0400
commit97e7449a7ad883bf9f516fc970778d75999c7843 (patch)
tree903f6de243847eb12d1a372b271b15046ecdc774 /fs/autofs4/autofs_i.h
parent26e81b3142f1ba497d4cd0365c13661684b784ce (diff)
autofs4: fix indirect mount pending expire race
The selection of a dentry for expiration and the setting of the AUTOFS_INF_EXPIRING flag isn't done atomically which can lead to lookups walking into an expiring mount. What happens is that an expire is initiated by the daemon and a dentry is selected for expire but, since there is no lock held between the selection and setting of the expiring flag, a process may find the flag clear and continue walking into the mount tree at the same time the daemon attempts the expire it. Signed-off-by: Ian Kent <raven@themaw.net> Reviewed-by: Jeff Moyer <jmoyer@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/autofs4/autofs_i.h')
-rw-r--r--fs/autofs4/autofs_i.h10
1 files changed, 3 insertions, 7 deletions
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
index 058e1800caec..5d90ed3b4b43 100644
--- a/fs/autofs4/autofs_i.h
+++ b/fs/autofs4/autofs_i.h
@@ -138,18 +138,14 @@ static inline int autofs4_oz_mode(struct autofs_sb_info *sbi) {
138static inline int autofs4_ispending(struct dentry *dentry) 138static inline int autofs4_ispending(struct dentry *dentry)
139{ 139{
140 struct autofs_info *inf = autofs4_dentry_ino(dentry); 140 struct autofs_info *inf = autofs4_dentry_ino(dentry);
141 int pending = 0;
142 141
143 if (dentry->d_flags & DCACHE_AUTOFS_PENDING) 142 if (dentry->d_flags & DCACHE_AUTOFS_PENDING)
144 return 1; 143 return 1;
145 144
146 if (inf) { 145 if (inf->flags & AUTOFS_INF_EXPIRING)
147 spin_lock(&inf->sbi->fs_lock); 146 return 1;
148 pending = inf->flags & AUTOFS_INF_EXPIRING;
149 spin_unlock(&inf->sbi->fs_lock);
150 }
151 147
152 return pending; 148 return 0;
153} 149}
154 150
155static inline void autofs4_copy_atime(struct file *src, struct file *dst) 151static inline void autofs4_copy_atime(struct file *src, struct file *dst)