aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exportfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/exportfs')
-rw-r--r--fs/exportfs/expfs.c56
1 files changed, 3 insertions, 53 deletions
diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
index 16287af3485..dd132bb7b8f 100644
--- a/fs/exportfs/expfs.c
+++ b/fs/exportfs/expfs.c
@@ -391,61 +391,11 @@ out:
391 return error; 391 return error;
392} 392}
393 393
394 394static struct dentry *get_dentry(struct super_block *sb, void *vobjp)
395static struct dentry *export_iget(struct super_block *sb, unsigned long ino, __u32 generation)
396{ 395{
397 396 return ERR_PTR(-ESTALE);
398 /* iget isn't really right if the inode is currently unallocated!!
399 * This should really all be done inside each filesystem
400 *
401 * ext2fs' read_inode has been strengthed to return a bad_inode if
402 * the inode had been deleted.
403 *
404 * Currently we don't know the generation for parent directory, so
405 * a generation of 0 means "accept any"
406 */
407 struct inode *inode;
408 struct dentry *result;
409 if (ino == 0)
410 return ERR_PTR(-ESTALE);
411 inode = iget(sb, ino);
412 if (inode == NULL)
413 return ERR_PTR(-ENOMEM);
414 if (is_bad_inode(inode)
415 || (generation && inode->i_generation != generation)
416 ) {
417 /* we didn't find the right inode.. */
418 dprintk("fh_verify: Inode %lu, Bad count: %d %d or version %u %u\n",
419 inode->i_ino,
420 inode->i_nlink, atomic_read(&inode->i_count),
421 inode->i_generation,
422 generation);
423
424 iput(inode);
425 return ERR_PTR(-ESTALE);
426 }
427 /* now to find a dentry.
428 * If possible, get a well-connected one
429 */
430 result = d_alloc_anon(inode);
431 if (!result) {
432 iput(inode);
433 return ERR_PTR(-ENOMEM);
434 }
435 return result;
436} 397}
437 398
438
439static struct dentry *get_object(struct super_block *sb, void *vobjp)
440{
441 __u32 *objp = vobjp;
442 unsigned long ino = objp[0];
443 __u32 generation = objp[1];
444
445 return export_iget(sb, ino, generation);
446}
447
448
449/** 399/**
450 * export_encode_fh - default export_operations->encode_fh function 400 * export_encode_fh - default export_operations->encode_fh function
451 * @dentry: the dentry to encode 401 * @dentry: the dentry to encode
@@ -524,7 +474,7 @@ struct export_operations export_op_default = {
524 474
525 .get_name = get_name, 475 .get_name = get_name,
526 .get_parent = get_parent, 476 .get_parent = get_parent,
527 .get_dentry = get_object, 477 .get_dentry = get_dentry,
528}; 478};
529 479
530EXPORT_SYMBOL(export_op_default); 480EXPORT_SYMBOL(export_op_default);