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.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 2a771ec6695..62d8d4acb8b 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);
@@ -193,6 +195,8 @@ static int autofs4_dir_open(struct inode *inode, struct file *file)
193 if (!empty) 195 if (!empty)
194 d_invalidate(dentry); 196 d_invalidate(dentry);
195 197
198 nd.dentry = dentry;
199 nd.mnt = mnt;
196 nd.flags = LOOKUP_DIRECTORY; 200 nd.flags = LOOKUP_DIRECTORY;
197 status = (dentry->d_op->d_revalidate)(dentry, &nd); 201 status = (dentry->d_op->d_revalidate)(dentry, &nd);
198 202
@@ -288,10 +292,10 @@ out:
288 return autofs4_dcache_readdir(file, dirent, filldir); 292 return autofs4_dcache_readdir(file, dirent, filldir);
289} 293}
290 294
291static int try_to_fill_dentry(struct dentry *dentry, 295static 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{ 296{
297 struct super_block *sb = mnt->mnt_sb;
298 struct autofs_sb_info *sbi = autofs4_sbi(sb);
295 struct autofs_info *de_info = autofs4_dentry_ino(dentry); 299 struct autofs_info *de_info = autofs4_dentry_ino(dentry);
296 int status = 0; 300 int status = 0;
297 301
@@ -366,7 +370,7 @@ static int try_to_fill_dentry(struct dentry *dentry,
366 /* We don't update the usages for the autofs daemon itself, this 370 /* We don't update the usages for the autofs daemon itself, this
367 is necessary for recursive autofs mounts */ 371 is necessary for recursive autofs mounts */
368 if (!autofs4_oz_mode(sbi)) 372 if (!autofs4_oz_mode(sbi))
369 autofs4_update_usage(dentry); 373 autofs4_update_usage(mnt, dentry);
370 374
371 spin_lock(&dentry->d_lock); 375 spin_lock(&dentry->d_lock);
372 dentry->d_flags &= ~DCACHE_AUTOFS_PENDING; 376 dentry->d_flags &= ~DCACHE_AUTOFS_PENDING;
@@ -391,7 +395,7 @@ static int autofs4_revalidate(struct dentry * dentry, struct nameidata *nd)
391 /* Pending dentry */ 395 /* Pending dentry */
392 if (autofs4_ispending(dentry)) { 396 if (autofs4_ispending(dentry)) {
393 if (!oz_mode) 397 if (!oz_mode)
394 status = try_to_fill_dentry(dentry, dir->i_sb, sbi, flags); 398 status = try_to_fill_dentry(nd->mnt, dentry, flags);
395 return status; 399 return status;
396 } 400 }
397 401
@@ -408,14 +412,14 @@ static int autofs4_revalidate(struct dentry * dentry, struct nameidata *nd)
408 dentry, dentry->d_name.len, dentry->d_name.name); 412 dentry, dentry->d_name.len, dentry->d_name.name);
409 spin_unlock(&dcache_lock); 413 spin_unlock(&dcache_lock);
410 if (!oz_mode) 414 if (!oz_mode)
411 status = try_to_fill_dentry(dentry, dir->i_sb, sbi, flags); 415 status = try_to_fill_dentry(nd->mnt, dentry, flags);
412 return status; 416 return status;
413 } 417 }
414 spin_unlock(&dcache_lock); 418 spin_unlock(&dcache_lock);
415 419
416 /* Update the usage list */ 420 /* Update the usage list */
417 if (!oz_mode) 421 if (!oz_mode)
418 autofs4_update_usage(dentry); 422 autofs4_update_usage(nd->mnt, dentry);
419 423
420 return 1; 424 return 1;
421} 425}
@@ -488,9 +492,9 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s
488 d_add(dentry, NULL); 492 d_add(dentry, NULL);
489 493
490 if (dentry->d_op && dentry->d_op->d_revalidate) { 494 if (dentry->d_op && dentry->d_op->d_revalidate) {
491 up(&dir->i_sem); 495 mutex_unlock(&dir->i_mutex);
492 (dentry->d_op->d_revalidate)(dentry, nd); 496 (dentry->d_op->d_revalidate)(dentry, nd);
493 down(&dir->i_sem); 497 mutex_lock(&dir->i_mutex);
494 } 498 }
495 499
496 /* 500 /*