aboutsummaryrefslogtreecommitdiffstats
path: root/fs/autofs4
diff options
context:
space:
mode:
Diffstat (limited to 'fs/autofs4')
-rw-r--r--fs/autofs4/autofs_i.h2
-rw-r--r--fs/autofs4/expire.c12
-rw-r--r--fs/autofs4/inode.c4
-rw-r--r--fs/autofs4/root.c28
4 files changed, 25 insertions, 21 deletions
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
index fca83e28edcf..385bed09b0d8 100644
--- a/fs/autofs4/autofs_i.h
+++ b/fs/autofs4/autofs_i.h
@@ -209,7 +209,7 @@ static inline int simple_empty_nolock(struct dentry *dentry)
209 struct dentry *child; 209 struct dentry *child;
210 int ret = 0; 210 int ret = 0;
211 211
212 list_for_each_entry(child, &dentry->d_subdirs, d_child) 212 list_for_each_entry(child, &dentry->d_subdirs, d_u.d_child)
213 if (simple_positive(child)) 213 if (simple_positive(child))
214 goto out; 214 goto out;
215 ret = 1; 215 ret = 1;
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c
index feb6ac427d05..dc39589df165 100644
--- a/fs/autofs4/expire.c
+++ b/fs/autofs4/expire.c
@@ -105,7 +105,7 @@ repeat:
105 next = this_parent->d_subdirs.next; 105 next = this_parent->d_subdirs.next;
106resume: 106resume:
107 while (next != &this_parent->d_subdirs) { 107 while (next != &this_parent->d_subdirs) {
108 struct dentry *dentry = list_entry(next, struct dentry, d_child); 108 struct dentry *dentry = list_entry(next, struct dentry, d_u.d_child);
109 109
110 /* Negative dentry - give up */ 110 /* Negative dentry - give up */
111 if (!simple_positive(dentry)) { 111 if (!simple_positive(dentry)) {
@@ -138,7 +138,7 @@ resume:
138 } 138 }
139 139
140 if (this_parent != top) { 140 if (this_parent != top) {
141 next = this_parent->d_child.next; 141 next = this_parent->d_u.d_child.next;
142 this_parent = this_parent->d_parent; 142 this_parent = this_parent->d_parent;
143 goto resume; 143 goto resume;
144 } 144 }
@@ -163,7 +163,7 @@ repeat:
163 next = this_parent->d_subdirs.next; 163 next = this_parent->d_subdirs.next;
164resume: 164resume:
165 while (next != &this_parent->d_subdirs) { 165 while (next != &this_parent->d_subdirs) {
166 struct dentry *dentry = list_entry(next, struct dentry, d_child); 166 struct dentry *dentry = list_entry(next, struct dentry, d_u.d_child);
167 167
168 /* Negative dentry - give up */ 168 /* Negative dentry - give up */
169 if (!simple_positive(dentry)) { 169 if (!simple_positive(dentry)) {
@@ -199,7 +199,7 @@ cont:
199 } 199 }
200 200
201 if (this_parent != parent) { 201 if (this_parent != parent) {
202 next = this_parent->d_child.next; 202 next = this_parent->d_u.d_child.next;
203 this_parent = this_parent->d_parent; 203 this_parent = this_parent->d_parent;
204 goto resume; 204 goto resume;
205 } 205 }
@@ -238,7 +238,7 @@ static struct dentry *autofs4_expire(struct super_block *sb,
238 /* On exit from the loop expire is set to a dgot dentry 238 /* On exit from the loop expire is set to a dgot dentry
239 * to expire or it's NULL */ 239 * to expire or it's NULL */
240 while ( next != &root->d_subdirs ) { 240 while ( next != &root->d_subdirs ) {
241 struct dentry *dentry = list_entry(next, struct dentry, d_child); 241 struct dentry *dentry = list_entry(next, struct dentry, d_u.d_child);
242 242
243 /* Negative dentry - give up */ 243 /* Negative dentry - give up */
244 if ( !simple_positive(dentry) ) { 244 if ( !simple_positive(dentry) ) {
@@ -302,7 +302,7 @@ next:
302 expired, (int)expired->d_name.len, expired->d_name.name); 302 expired, (int)expired->d_name.len, expired->d_name.name);
303 spin_lock(&dcache_lock); 303 spin_lock(&dcache_lock);
304 list_del(&expired->d_parent->d_subdirs); 304 list_del(&expired->d_parent->d_subdirs);
305 list_add(&expired->d_parent->d_subdirs, &expired->d_child); 305 list_add(&expired->d_parent->d_subdirs, &expired->d_u.d_child);
306 spin_unlock(&dcache_lock); 306 spin_unlock(&dcache_lock);
307 return expired; 307 return expired;
308 } 308 }
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index 818b37be5153..2d3082854a29 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -91,7 +91,7 @@ repeat:
91 next = this_parent->d_subdirs.next; 91 next = this_parent->d_subdirs.next;
92resume: 92resume:
93 while (next != &this_parent->d_subdirs) { 93 while (next != &this_parent->d_subdirs) {
94 struct dentry *dentry = list_entry(next, struct dentry, d_child); 94 struct dentry *dentry = list_entry(next, struct dentry, d_u.d_child);
95 95
96 /* Negative dentry - don`t care */ 96 /* Negative dentry - don`t care */
97 if (!simple_positive(dentry)) { 97 if (!simple_positive(dentry)) {
@@ -117,7 +117,7 @@ resume:
117 if (this_parent != sbi->root) { 117 if (this_parent != sbi->root) {
118 struct dentry *dentry = this_parent; 118 struct dentry *dentry = this_parent;
119 119
120 next = this_parent->d_child.next; 120 next = this_parent->d_u.d_child.next;
121 this_parent = this_parent->d_parent; 121 this_parent = this_parent->d_parent;
122 spin_unlock(&dcache_lock); 122 spin_unlock(&dcache_lock);
123 DPRINTK("parent dentry %p %.*s", 123 DPRINTK("parent dentry %p %.*s",
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 2a771ec66956..62d8d4acb8bb 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 /*