aboutsummaryrefslogtreecommitdiffstats
path: root/fs/autofs4/autofs_i.h
diff options
context:
space:
mode:
authorIan Kent <raven@themaw.net>2005-05-01 11:59:17 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-01 11:59:17 -0400
commit3a9720ce73c9247e5262922d65e90444ea75eb50 (patch)
treec70bba916168232f530c00858e7e8a0c5bd82b38 /fs/autofs4/autofs_i.h
parent4dcd00b18118d174c4b8d838c11f437f0af3c20c (diff)
[PATCH] autofs4: tree race fix
For tree mount maps, a call to chdir or chroot, to a directory above the moint point directories at a certain time during the expire results in the expire incorrectly thinking the tree is not busy. This patch adds a check to see if the filesystem above the tree mount points is busy and also locks the filesystem during the tree mount expire to prevent the race. Signed-off-by: Ian Kent <raven@themaw.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/autofs4/autofs_i.h')
-rw-r--r--fs/autofs4/autofs_i.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
index 978987735252..c7b2b8890188 100644
--- a/fs/autofs4/autofs_i.h
+++ b/fs/autofs4/autofs_i.h
@@ -102,6 +102,7 @@ struct autofs_sb_info {
102 int needs_reghost; 102 int needs_reghost;
103 struct super_block *sb; 103 struct super_block *sb;
104 struct semaphore wq_sem; 104 struct semaphore wq_sem;
105 spinlock_t fs_lock;
105 struct autofs_wait_queue *queues; /* Wait queue pointer */ 106 struct autofs_wait_queue *queues; /* Wait queue pointer */
106}; 107};
107 108
@@ -127,9 +128,18 @@ static inline int autofs4_oz_mode(struct autofs_sb_info *sbi) {
127static inline int autofs4_ispending(struct dentry *dentry) 128static inline int autofs4_ispending(struct dentry *dentry)
128{ 129{
129 struct autofs_info *inf = autofs4_dentry_ino(dentry); 130 struct autofs_info *inf = autofs4_dentry_ino(dentry);
131 int pending = 0;
130 132
131 return (dentry->d_flags & DCACHE_AUTOFS_PENDING) || 133 if (dentry->d_flags & DCACHE_AUTOFS_PENDING)
132 (inf != NULL && inf->flags & AUTOFS_INF_EXPIRING); 134 return 1;
135
136 if (inf) {
137 spin_lock(&inf->sbi->fs_lock);
138 pending = inf->flags & AUTOFS_INF_EXPIRING;
139 spin_unlock(&inf->sbi->fs_lock);
140 }
141
142 return pending;
133} 143}
134 144
135static inline void autofs4_copy_atime(struct file *src, struct file *dst) 145static inline void autofs4_copy_atime(struct file *src, struct file *dst)