aboutsummaryrefslogtreecommitdiffstats
path: root/fs/autofs4/root.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/autofs4/root.c')
-rw-r--r--fs/autofs4/root.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 2a771ec66956..e93a7ae467c9 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -12,6 +12,7 @@
12 * 12 *
13 * ------------------------------------------------------------------------- */ 13 * ------------------------------------------------------------------------- */
14 14
15#include <linux/capability.h>
15#include <linux/errno.h> 16#include <linux/errno.h>
16#include <linux/stat.h> 17#include <linux/stat.h>
17#include <linux/param.h> 18#include <linux/param.h>
@@ -86,7 +87,7 @@ static int autofs4_root_readdir(struct file *file, void *dirent,
86 87
87/* Update usage from here to top of tree, so that scan of 88/* Update usage from here to top of tree, so that scan of
88 top-level directories will give a useful result */ 89 top-level directories will give a useful result */
89static void autofs4_update_usage(struct dentry *dentry) 90static void autofs4_update_usage(struct vfsmount *mnt, struct dentry *dentry)
90{ 91{
91 struct dentry *top = dentry->d_sb->s_root; 92 struct dentry *top = dentry->d_sb->s_root;
92 93
@@ -95,7 +96,7 @@ static void autofs4_update_usage(struct dentry *dentry)
95 struct autofs_info *ino = autofs4_dentry_ino(dentry); 96 struct autofs_info *ino = autofs4_dentry_ino(dentry);
96 97
97 if (ino) { 98 if (ino) {
98 update_atime(dentry->d_inode); 99 touch_atime(mnt, dentry);
99 ino->last_used = jiffies; 100 ino->last_used = jiffies;
100 } 101 }
101 } 102 }
@@ -143,7 +144,8 @@ static int autofs4_dcache_readdir(struct file * filp, void * dirent, filldir_t f
143 } 144 }
144 145
145 while(1) { 146 while(1) {
146 struct dentry *de = list_entry(list, struct dentry, d_child); 147 struct dentry *de = list_entry(list,
148 struct dentry, d_u.d_child);
147 149
148 if (!d_unhashed(de) && de->d_inode) { 150 if (!d_unhashed(de) && de->d_inode) {
149 spin_unlock(&dcache_lock); 151 spin_unlock(&dcache_lock);
@@ -288,10 +290,10 @@ out:
288 return autofs4_dcache_readdir(file, dirent, filldir); 290 return autofs4_dcache_readdir(file, dirent, filldir);
289} 291}
290 292
291static int try_to_fill_dentry(struct dentry *dentry, 293static int try_to_fill_dentry(struct vfsmount *mnt, struct dentry *dentry, int flags)
292 struct super_block *sb,
293 struct autofs_sb_info *sbi, int flags)
294{ 294{
295 struct super_block *sb = mnt->mnt_sb;
296 struct autofs_sb_info *sbi = autofs4_sbi(sb);
295 struct autofs_info *de_info = autofs4_dentry_ino(dentry); 297 struct autofs_info *de_info = autofs4_dentry_ino(dentry);
296 int status = 0; 298 int status = 0;
297 299
@@ -366,7 +368,7 @@ static int try_to_fill_dentry(struct dentry *dentry,
366 /* We don't update the usages for the autofs daemon itself, this 368 /* We don't update the usages for the autofs daemon itself, this
367 is necessary for recursive autofs mounts */ 369 is necessary for recursive autofs mounts */
368 if (!autofs4_oz_mode(sbi)) 370 if (!autofs4_oz_mode(sbi))
369 autofs4_update_usage(dentry); 371 autofs4_update_usage(mnt, dentry);
370 372
371 spin_lock(&dentry->d_lock); 373 spin_lock(&dentry->d_lock);
372 dentry->d_flags &= ~DCACHE_AUTOFS_PENDING; 374 dentry->d_flags &= ~DCACHE_AUTOFS_PENDING;
@@ -391,7 +393,7 @@ static int autofs4_revalidate(struct dentry * dentry, struct nameidata *nd)
391 /* Pending dentry */ 393 /* Pending dentry */
392 if (autofs4_ispending(dentry)) { 394 if (autofs4_ispending(dentry)) {
393 if (!oz_mode) 395 if (!oz_mode)
394 status = try_to_fill_dentry(dentry, dir->i_sb, sbi, flags); 396 status = try_to_fill_dentry(nd->mnt, dentry, flags);
395 return status; 397 return status;
396 } 398 }
397 399
@@ -408,14 +410,14 @@ static int autofs4_revalidate(struct dentry * dentry, struct nameidata *nd)
408 dentry, dentry->d_name.len, dentry->d_name.name); 410 dentry, dentry->d_name.len, dentry->d_name.name);
409 spin_unlock(&dcache_lock); 411 spin_unlock(&dcache_lock);
410 if (!oz_mode) 412 if (!oz_mode)
411 status = try_to_fill_dentry(dentry, dir->i_sb, sbi, flags); 413 status = try_to_fill_dentry(nd->mnt, dentry, flags);
412 return status; 414 return status;
413 } 415 }
414 spin_unlock(&dcache_lock); 416 spin_unlock(&dcache_lock);
415 417
416 /* Update the usage list */ 418 /* Update the usage list */
417 if (!oz_mode) 419 if (!oz_mode)
418 autofs4_update_usage(dentry); 420 autofs4_update_usage(nd->mnt, dentry);
419 421
420 return 1; 422 return 1;
421} 423}
@@ -488,9 +490,9 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s
488 d_add(dentry, NULL); 490 d_add(dentry, NULL);
489 491
490 if (dentry->d_op && dentry->d_op->d_revalidate) { 492 if (dentry->d_op && dentry->d_op->d_revalidate) {
491 up(&dir->i_sem); 493 mutex_unlock(&dir->i_mutex);
492 (dentry->d_op->d_revalidate)(dentry, nd); 494 (dentry->d_op->d_revalidate)(dentry, nd);
493 down(&dir->i_sem); 495 mutex_lock(&dir->i_mutex);
494 } 496 }
495 497
496 /* 498 /*