aboutsummaryrefslogtreecommitdiffstats
path: root/fs/autofs/root.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2008-02-07 03:15:30 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 11:42:27 -0500
commit62328a02399ea7f1b26b06d757abe67b9cf48193 (patch)
tree11ac645b65d8735db96c962c814b80adf6e8f195 /fs/autofs/root.c
parent210f855963ba5edc4c7150754a79709a7c8a0d3c (diff)
iget: stop autofs from using iget() and read_inode()
Stop the autofs filesystem from using iget() and read_inode(). Replace autofs_read_inode() with autofs_iget(), and call that instead of iget(). autofs_iget() then uses iget_locked() directly and returns a proper error code instead of an inode in the event of an error. Signed-off-by: David Howells <dhowells@redhat.com> Cc: Ian Kent <raven@themaw.net> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/autofs/root.c')
-rw-r--r--fs/autofs/root.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/fs/autofs/root.c b/fs/autofs/root.c
index 5efff3c0d886..8aacade56956 100644
--- a/fs/autofs/root.c
+++ b/fs/autofs/root.c
@@ -114,8 +114,8 @@ static int try_to_fill_dentry(struct dentry *dentry, struct super_block *sb, str
114 dentry->d_time = (unsigned long) ent; 114 dentry->d_time = (unsigned long) ent;
115 115
116 if (!dentry->d_inode) { 116 if (!dentry->d_inode) {
117 inode = iget(sb, ent->ino); 117 inode = autofs_iget(sb, ent->ino);
118 if (!inode) { 118 if (IS_ERR(inode)) {
119 /* Failed, but leave pending for next time */ 119 /* Failed, but leave pending for next time */
120 return 1; 120 return 1;
121 } 121 }
@@ -274,6 +274,7 @@ static int autofs_root_symlink(struct inode *dir, struct dentry *dentry, const c
274 unsigned int n; 274 unsigned int n;
275 int slsize; 275 int slsize;
276 struct autofs_symlink *sl; 276 struct autofs_symlink *sl;
277 struct inode *inode;
277 278
278 DPRINTK(("autofs_root_symlink: %s <- ", symname)); 279 DPRINTK(("autofs_root_symlink: %s <- ", symname));
279 autofs_say(dentry->d_name.name,dentry->d_name.len); 280 autofs_say(dentry->d_name.name,dentry->d_name.len);
@@ -331,7 +332,12 @@ static int autofs_root_symlink(struct inode *dir, struct dentry *dentry, const c
331 ent->dentry = NULL; /* We don't keep the dentry for symlinks */ 332 ent->dentry = NULL; /* We don't keep the dentry for symlinks */
332 333
333 autofs_hash_insert(dh,ent); 334 autofs_hash_insert(dh,ent);
334 d_instantiate(dentry, iget(dir->i_sb,ent->ino)); 335
336 inode = autofs_iget(dir->i_sb, ent->ino);
337 if (IS_ERR(inode))
338 return PTR_ERR(inode);
339
340 d_instantiate(dentry, inode);
335 unlock_kernel(); 341 unlock_kernel();
336 return 0; 342 return 0;
337} 343}
@@ -428,6 +434,7 @@ static int autofs_root_mkdir(struct inode *dir, struct dentry *dentry, int mode)
428 struct autofs_sb_info *sbi = autofs_sbi(dir->i_sb); 434 struct autofs_sb_info *sbi = autofs_sbi(dir->i_sb);
429 struct autofs_dirhash *dh = &sbi->dirhash; 435 struct autofs_dirhash *dh = &sbi->dirhash;
430 struct autofs_dir_ent *ent; 436 struct autofs_dir_ent *ent;
437 struct inode *inode;
431 ino_t ino; 438 ino_t ino;
432 439
433 lock_kernel(); 440 lock_kernel();
@@ -469,7 +476,14 @@ static int autofs_root_mkdir(struct inode *dir, struct dentry *dentry, int mode)
469 autofs_hash_insert(dh,ent); 476 autofs_hash_insert(dh,ent);
470 477
471 inc_nlink(dir); 478 inc_nlink(dir);
472 d_instantiate(dentry, iget(dir->i_sb,ino)); 479
480 inode = autofs_iget(dir->i_sb, ino);
481 if (IS_ERR(inode)) {
482 drop_nlink(dir);
483 return PTR_ERR(inode);
484 }
485
486 d_instantiate(dentry, inode);
473 unlock_kernel(); 487 unlock_kernel();
474 488
475 return 0; 489 return 0;