diff options
-rw-r--r-- | fs/autofs4/root.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index 62d8d4acb8bb..2c676bd44acd 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c | |||
@@ -296,20 +296,20 @@ static int try_to_fill_dentry(struct vfsmount *mnt, struct dentry *dentry, int f | |||
296 | { | 296 | { |
297 | struct super_block *sb = mnt->mnt_sb; | 297 | struct super_block *sb = mnt->mnt_sb; |
298 | struct autofs_sb_info *sbi = autofs4_sbi(sb); | 298 | struct autofs_sb_info *sbi = autofs4_sbi(sb); |
299 | struct autofs_info *de_info = autofs4_dentry_ino(dentry); | 299 | struct autofs_info *ino = autofs4_dentry_ino(dentry); |
300 | int status = 0; | 300 | int status = 0; |
301 | 301 | ||
302 | /* Block on any pending expiry here; invalidate the dentry | 302 | /* Block on any pending expiry here; invalidate the dentry |
303 | when expiration is done to trigger mount request with a new | 303 | when expiration is done to trigger mount request with a new |
304 | dentry */ | 304 | dentry */ |
305 | if (de_info && (de_info->flags & AUTOFS_INF_EXPIRING)) { | 305 | if (ino && (ino->flags & AUTOFS_INF_EXPIRING)) { |
306 | DPRINTK("waiting for expire %p name=%.*s", | 306 | DPRINTK("waiting for expire %p name=%.*s", |
307 | dentry, dentry->d_name.len, dentry->d_name.name); | 307 | dentry, dentry->d_name.len, dentry->d_name.name); |
308 | 308 | ||
309 | status = autofs4_wait(sbi, dentry, NFY_NONE); | 309 | status = autofs4_wait(sbi, dentry, NFY_NONE); |
310 | 310 | ||
311 | DPRINTK("expire done status=%d", status); | 311 | DPRINTK("expire done status=%d", status); |
312 | 312 | ||
313 | /* | 313 | /* |
314 | * If the directory still exists the mount request must | 314 | * If the directory still exists the mount request must |
315 | * continue otherwise it can't be followed at the right | 315 | * continue otherwise it can't be followed at the right |
@@ -323,18 +323,21 @@ static int try_to_fill_dentry(struct vfsmount *mnt, struct dentry *dentry, int f | |||
323 | DPRINTK("dentry=%p %.*s ino=%p", | 323 | DPRINTK("dentry=%p %.*s ino=%p", |
324 | dentry, dentry->d_name.len, dentry->d_name.name, dentry->d_inode); | 324 | dentry, dentry->d_name.len, dentry->d_name.name, dentry->d_inode); |
325 | 325 | ||
326 | /* Wait for a pending mount, triggering one if there isn't one already */ | 326 | /* |
327 | * Wait for a pending mount, triggering one if there | ||
328 | * isn't one already | ||
329 | */ | ||
327 | if (dentry->d_inode == NULL) { | 330 | if (dentry->d_inode == NULL) { |
328 | DPRINTK("waiting for mount name=%.*s", | 331 | DPRINTK("waiting for mount name=%.*s", |
329 | dentry->d_name.len, dentry->d_name.name); | 332 | dentry->d_name.len, dentry->d_name.name); |
330 | 333 | ||
331 | status = autofs4_wait(sbi, dentry, NFY_MOUNT); | 334 | status = autofs4_wait(sbi, dentry, NFY_MOUNT); |
332 | 335 | ||
333 | DPRINTK("mount done status=%d", status); | 336 | DPRINTK("mount done status=%d", status); |
334 | 337 | ||
335 | if (status && dentry->d_inode) | 338 | if (status && dentry->d_inode) |
336 | return 0; /* Try to get the kernel to invalidate this dentry */ | 339 | return 0; /* Try to get the kernel to invalidate this dentry */ |
337 | 340 | ||
338 | /* Turn this into a real negative dentry? */ | 341 | /* Turn this into a real negative dentry? */ |
339 | if (status == -ENOENT) { | 342 | if (status == -ENOENT) { |
340 | dentry->d_time = jiffies + AUTOFS_NEGATIVE_TIMEOUT; | 343 | dentry->d_time = jiffies + AUTOFS_NEGATIVE_TIMEOUT; |
@@ -367,8 +370,10 @@ static int try_to_fill_dentry(struct vfsmount *mnt, struct dentry *dentry, int f | |||
367 | } | 370 | } |
368 | } | 371 | } |
369 | 372 | ||
370 | /* We don't update the usages for the autofs daemon itself, this | 373 | /* |
371 | is necessary for recursive autofs mounts */ | 374 | * We don't update the usages for the autofs daemon itself, this |
375 | * is necessary for recursive autofs mounts | ||
376 | */ | ||
372 | if (!autofs4_oz_mode(sbi)) | 377 | if (!autofs4_oz_mode(sbi)) |
373 | autofs4_update_usage(mnt, dentry); | 378 | autofs4_update_usage(mnt, dentry); |
374 | 379 | ||
@@ -384,9 +389,9 @@ static int try_to_fill_dentry(struct vfsmount *mnt, struct dentry *dentry, int f | |||
384 | * yet completely filled in, and revalidate has to delay such | 389 | * yet completely filled in, and revalidate has to delay such |
385 | * lookups.. | 390 | * lookups.. |
386 | */ | 391 | */ |
387 | static int autofs4_revalidate(struct dentry * dentry, struct nameidata *nd) | 392 | static int autofs4_revalidate(struct dentry *dentry, struct nameidata *nd) |
388 | { | 393 | { |
389 | struct inode * dir = dentry->d_parent->d_inode; | 394 | struct inode *dir = dentry->d_parent->d_inode; |
390 | struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb); | 395 | struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb); |
391 | int oz_mode = autofs4_oz_mode(sbi); | 396 | int oz_mode = autofs4_oz_mode(sbi); |
392 | int flags = nd ? nd->flags : 0; | 397 | int flags = nd ? nd->flags : 0; |
@@ -462,12 +467,13 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s | |||
462 | DPRINTK("name = %.*s", | 467 | DPRINTK("name = %.*s", |
463 | dentry->d_name.len, dentry->d_name.name); | 468 | dentry->d_name.len, dentry->d_name.name); |
464 | 469 | ||
470 | /* File name too long to exist */ | ||
465 | if (dentry->d_name.len > NAME_MAX) | 471 | if (dentry->d_name.len > NAME_MAX) |
466 | return ERR_PTR(-ENAMETOOLONG);/* File name too long to exist */ | 472 | return ERR_PTR(-ENAMETOOLONG); |
467 | 473 | ||
468 | sbi = autofs4_sbi(dir->i_sb); | 474 | sbi = autofs4_sbi(dir->i_sb); |
469 | |||
470 | oz_mode = autofs4_oz_mode(sbi); | 475 | oz_mode = autofs4_oz_mode(sbi); |
476 | |||
471 | DPRINTK("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d", | 477 | DPRINTK("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d", |
472 | current->pid, process_group(current), sbi->catatonic, oz_mode); | 478 | current->pid, process_group(current), sbi->catatonic, oz_mode); |
473 | 479 | ||
@@ -519,7 +525,7 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s | |||
519 | * doesn't do the right thing for all system calls, but it should | 525 | * doesn't do the right thing for all system calls, but it should |
520 | * be OK for the operations we permit from an autofs. | 526 | * be OK for the operations we permit from an autofs. |
521 | */ | 527 | */ |
522 | if ( dentry->d_inode && d_unhashed(dentry) ) | 528 | if (dentry->d_inode && d_unhashed(dentry)) |
523 | return ERR_PTR(-ENOENT); | 529 | return ERR_PTR(-ENOENT); |
524 | 530 | ||
525 | return NULL; | 531 | return NULL; |