diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/efs/namei.c | 32 | ||||
-rw-r--r-- | fs/efs/super.c | 1 | ||||
-rw-r--r-- | fs/exportfs/expfs.c | 56 | ||||
-rw-r--r-- | fs/jfs/jfs_inode.h | 1 | ||||
-rw-r--r-- | fs/jfs/namei.c | 32 | ||||
-rw-r--r-- | fs/jfs/super.c | 1 |
6 files changed, 70 insertions, 53 deletions
diff --git a/fs/efs/namei.c b/fs/efs/namei.c index ed4a207fe22a..5276b19423c1 100644 --- a/fs/efs/namei.c +++ b/fs/efs/namei.c | |||
@@ -75,6 +75,38 @@ struct dentry *efs_lookup(struct inode *dir, struct dentry *dentry, struct namei | |||
75 | return NULL; | 75 | return NULL; |
76 | } | 76 | } |
77 | 77 | ||
78 | struct dentry *efs_get_dentry(struct super_block *sb, void *vobjp) | ||
79 | { | ||
80 | __u32 *objp = vobjp; | ||
81 | unsigned long ino = objp[0]; | ||
82 | __u32 generation = objp[1]; | ||
83 | struct inode *inode; | ||
84 | struct dentry *result; | ||
85 | |||
86 | if (ino == 0) | ||
87 | return ERR_PTR(-ESTALE); | ||
88 | inode = iget(sb, ino); | ||
89 | if (inode == NULL) | ||
90 | return ERR_PTR(-ENOMEM); | ||
91 | |||
92 | if (is_bad_inode(inode) || | ||
93 | (generation && inode->i_generation != generation)) { | ||
94 | result = ERR_PTR(-ESTALE); | ||
95 | goto out_iput; | ||
96 | } | ||
97 | |||
98 | result = d_alloc_anon(inode); | ||
99 | if (!result) { | ||
100 | result = ERR_PTR(-ENOMEM); | ||
101 | goto out_iput; | ||
102 | } | ||
103 | return result; | ||
104 | |||
105 | out_iput: | ||
106 | iput(inode); | ||
107 | return result; | ||
108 | } | ||
109 | |||
78 | struct dentry *efs_get_parent(struct dentry *child) | 110 | struct dentry *efs_get_parent(struct dentry *child) |
79 | { | 111 | { |
80 | struct dentry *parent; | 112 | struct dentry *parent; |
diff --git a/fs/efs/super.c b/fs/efs/super.c index 67338d622f56..d360c81f3a72 100644 --- a/fs/efs/super.c +++ b/fs/efs/super.c | |||
@@ -114,6 +114,7 @@ static const struct super_operations efs_superblock_operations = { | |||
114 | }; | 114 | }; |
115 | 115 | ||
116 | static struct export_operations efs_export_ops = { | 116 | static struct export_operations efs_export_ops = { |
117 | .get_dentry = efs_get_dentry, | ||
117 | .get_parent = efs_get_parent, | 118 | .get_parent = efs_get_parent, |
118 | }; | 119 | }; |
119 | 120 | ||
diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c index 16287af34859..dd132bb7b8f8 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 | 394 | static struct dentry *get_dentry(struct super_block *sb, void *vobjp) | |
395 | static 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 | |||
439 | static 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 | ||
530 | EXPORT_SYMBOL(export_op_default); | 480 | EXPORT_SYMBOL(export_op_default); |
diff --git a/fs/jfs/jfs_inode.h b/fs/jfs/jfs_inode.h index 2374b595f2e1..f0ec72b263f1 100644 --- a/fs/jfs/jfs_inode.h +++ b/fs/jfs/jfs_inode.h | |||
@@ -32,6 +32,7 @@ extern void jfs_truncate_nolock(struct inode *, loff_t); | |||
32 | extern void jfs_free_zero_link(struct inode *); | 32 | extern void jfs_free_zero_link(struct inode *); |
33 | extern struct dentry *jfs_get_parent(struct dentry *dentry); | 33 | extern struct dentry *jfs_get_parent(struct dentry *dentry); |
34 | extern void jfs_get_inode_flags(struct jfs_inode_info *); | 34 | extern void jfs_get_inode_flags(struct jfs_inode_info *); |
35 | extern struct dentry *jfs_get_dentry(struct super_block *sb, void *vobjp); | ||
35 | extern void jfs_set_inode_flags(struct inode *); | 36 | extern void jfs_set_inode_flags(struct inode *); |
36 | extern int jfs_get_block(struct inode *, sector_t, struct buffer_head *, int); | 37 | extern int jfs_get_block(struct inode *, sector_t, struct buffer_head *, int); |
37 | 38 | ||
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c index 25161c4121e4..932797ba433b 100644 --- a/fs/jfs/namei.c +++ b/fs/jfs/namei.c | |||
@@ -1477,6 +1477,38 @@ static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry, struc | |||
1477 | return dentry; | 1477 | return dentry; |
1478 | } | 1478 | } |
1479 | 1479 | ||
1480 | struct dentry *jfs_get_dentry(struct super_block *sb, void *vobjp) | ||
1481 | { | ||
1482 | __u32 *objp = vobjp; | ||
1483 | unsigned long ino = objp[0]; | ||
1484 | __u32 generation = objp[1]; | ||
1485 | struct inode *inode; | ||
1486 | struct dentry *result; | ||
1487 | |||
1488 | if (ino == 0) | ||
1489 | return ERR_PTR(-ESTALE); | ||
1490 | inode = iget(sb, ino); | ||
1491 | if (inode == NULL) | ||
1492 | return ERR_PTR(-ENOMEM); | ||
1493 | |||
1494 | if (is_bad_inode(inode) || | ||
1495 | (generation && inode->i_generation != generation)) { | ||
1496 | result = ERR_PTR(-ESTALE); | ||
1497 | goto out_iput; | ||
1498 | } | ||
1499 | |||
1500 | result = d_alloc_anon(inode); | ||
1501 | if (!result) { | ||
1502 | result = ERR_PTR(-ENOMEM); | ||
1503 | goto out_iput; | ||
1504 | } | ||
1505 | return result; | ||
1506 | |||
1507 | out_iput: | ||
1508 | iput(inode); | ||
1509 | return result; | ||
1510 | } | ||
1511 | |||
1480 | struct dentry *jfs_get_parent(struct dentry *dentry) | 1512 | struct dentry *jfs_get_parent(struct dentry *dentry) |
1481 | { | 1513 | { |
1482 | struct super_block *sb = dentry->d_inode->i_sb; | 1514 | struct super_block *sb = dentry->d_inode->i_sb; |
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index 49b652bd96ba..929fceca7999 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
@@ -738,6 +738,7 @@ static const struct super_operations jfs_super_operations = { | |||
738 | }; | 738 | }; |
739 | 739 | ||
740 | static struct export_operations jfs_export_operations = { | 740 | static struct export_operations jfs_export_operations = { |
741 | .get_dentry = jfs_get_dentry, | ||
741 | .get_parent = jfs_get_parent, | 742 | .get_parent = jfs_get_parent, |
742 | }; | 743 | }; |
743 | 744 | ||