aboutsummaryrefslogtreecommitdiffstats
path: root/fs/autofs4
diff options
context:
space:
mode:
Diffstat (limited to 'fs/autofs4')
-rw-r--r--fs/autofs4/root.c38
1 files changed, 4 insertions, 34 deletions
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 3a4a5b47575c..72dca3335e25 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -84,24 +84,6 @@ static int autofs4_root_readdir(struct file *file, void *dirent,
84 return dcache_readdir(file, dirent, filldir); 84 return dcache_readdir(file, dirent, filldir);
85} 85}
86 86
87/* Update usage from here to top of tree, so that scan of
88 top-level directories will give a useful result */
89static void autofs4_update_usage(struct vfsmount *mnt, struct dentry *dentry)
90{
91 struct dentry *top = dentry->d_sb->s_root;
92
93 spin_lock(&dcache_lock);
94 for(; dentry != top; dentry = dentry->d_parent) {
95 struct autofs_info *ino = autofs4_dentry_ino(dentry);
96
97 if (ino) {
98 touch_atime(mnt, dentry);
99 ino->last_used = jiffies;
100 }
101 }
102 spin_unlock(&dcache_lock);
103}
104
105static int autofs4_dir_open(struct inode *inode, struct file *file) 87static int autofs4_dir_open(struct inode *inode, struct file *file)
106{ 88{
107 struct dentry *dentry = file->f_dentry; 89 struct dentry *dentry = file->f_dentry;
@@ -246,10 +228,9 @@ out:
246 return dcache_readdir(file, dirent, filldir); 228 return dcache_readdir(file, dirent, filldir);
247} 229}
248 230
249static int try_to_fill_dentry(struct vfsmount *mnt, struct dentry *dentry, int flags) 231static int try_to_fill_dentry(struct dentry *dentry, int flags)
250{ 232{
251 struct super_block *sb = mnt->mnt_sb; 233 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
252 struct autofs_sb_info *sbi = autofs4_sbi(sb);
253 struct autofs_info *ino = autofs4_dentry_ino(dentry); 234 struct autofs_info *ino = autofs4_dentry_ino(dentry);
254 int status = 0; 235 int status = 0;
255 236
@@ -323,13 +304,6 @@ static int try_to_fill_dentry(struct vfsmount *mnt, struct dentry *dentry, int f
323 } 304 }
324 } 305 }
325 306
326 /*
327 * We don't update the usages for the autofs daemon itself, this
328 * is necessary for recursive autofs mounts
329 */
330 if (!autofs4_oz_mode(sbi))
331 autofs4_update_usage(mnt, dentry);
332
333 /* Initialize expiry counter after successful mount */ 307 /* Initialize expiry counter after successful mount */
334 if (ino) 308 if (ino)
335 ino->last_used = jiffies; 309 ino->last_used = jiffies;
@@ -357,7 +331,7 @@ static int autofs4_revalidate(struct dentry *dentry, struct nameidata *nd)
357 /* Pending dentry */ 331 /* Pending dentry */
358 if (autofs4_ispending(dentry)) { 332 if (autofs4_ispending(dentry)) {
359 if (!oz_mode) 333 if (!oz_mode)
360 status = try_to_fill_dentry(nd->mnt, dentry, flags); 334 status = try_to_fill_dentry(dentry, flags);
361 return status; 335 return status;
362 } 336 }
363 337
@@ -374,15 +348,11 @@ static int autofs4_revalidate(struct dentry *dentry, struct nameidata *nd)
374 dentry, dentry->d_name.len, dentry->d_name.name); 348 dentry, dentry->d_name.len, dentry->d_name.name);
375 spin_unlock(&dcache_lock); 349 spin_unlock(&dcache_lock);
376 if (!oz_mode) 350 if (!oz_mode)
377 status = try_to_fill_dentry(nd->mnt, dentry, flags); 351 status = try_to_fill_dentry(dentry, flags);
378 return status; 352 return status;
379 } 353 }
380 spin_unlock(&dcache_lock); 354 spin_unlock(&dcache_lock);
381 355
382 /* Update the usage list */
383 if (!oz_mode)
384 autofs4_update_usage(nd->mnt, dentry);
385
386 return 1; 356 return 1;
387} 357}
388 358