diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext2/super.c | 39 | ||||
-rw-r--r-- | fs/ext3/inode.c | 2 | ||||
-rw-r--r-- | fs/ext3/super.c | 42 | ||||
-rw-r--r-- | fs/jffs2/summary.c | 5 |
4 files changed, 87 insertions, 1 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 681dea8f9532..ca5bfb6914d2 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c | |||
@@ -251,6 +251,44 @@ static struct super_operations ext2_sops = { | |||
251 | #endif | 251 | #endif |
252 | }; | 252 | }; |
253 | 253 | ||
254 | static struct dentry *ext2_get_dentry(struct super_block *sb, void *vobjp) | ||
255 | { | ||
256 | __u32 *objp = vobjp; | ||
257 | unsigned long ino = objp[0]; | ||
258 | __u32 generation = objp[1]; | ||
259 | struct inode *inode; | ||
260 | struct dentry *result; | ||
261 | |||
262 | if (ino < EXT2_FIRST_INO(sb) && ino != EXT2_ROOT_INO) | ||
263 | return ERR_PTR(-ESTALE); | ||
264 | if (ino > le32_to_cpu(EXT2_SB(sb)->s_es->s_inodes_count)) | ||
265 | return ERR_PTR(-ESTALE); | ||
266 | |||
267 | /* iget isn't really right if the inode is currently unallocated!! | ||
268 | * ext2_read_inode currently does appropriate checks, but | ||
269 | * it might be "neater" to call ext2_get_inode first and check | ||
270 | * if the inode is valid..... | ||
271 | */ | ||
272 | inode = iget(sb, ino); | ||
273 | if (inode == NULL) | ||
274 | return ERR_PTR(-ENOMEM); | ||
275 | if (is_bad_inode(inode) || | ||
276 | (generation && inode->i_generation != generation)) { | ||
277 | /* we didn't find the right inode.. */ | ||
278 | iput(inode); | ||
279 | return ERR_PTR(-ESTALE); | ||
280 | } | ||
281 | /* now to find a dentry. | ||
282 | * If possible, get a well-connected one | ||
283 | */ | ||
284 | result = d_alloc_anon(inode); | ||
285 | if (!result) { | ||
286 | iput(inode); | ||
287 | return ERR_PTR(-ENOMEM); | ||
288 | } | ||
289 | return result; | ||
290 | } | ||
291 | |||
254 | /* Yes, most of these are left as NULL!! | 292 | /* Yes, most of these are left as NULL!! |
255 | * A NULL value implies the default, which works with ext2-like file | 293 | * A NULL value implies the default, which works with ext2-like file |
256 | * systems, but can be improved upon. | 294 | * systems, but can be improved upon. |
@@ -258,6 +296,7 @@ static struct super_operations ext2_sops = { | |||
258 | */ | 296 | */ |
259 | static struct export_operations ext2_export_ops = { | 297 | static struct export_operations ext2_export_ops = { |
260 | .get_parent = ext2_get_parent, | 298 | .get_parent = ext2_get_parent, |
299 | .get_dentry = ext2_get_dentry, | ||
261 | }; | 300 | }; |
262 | 301 | ||
263 | static unsigned long get_sb_block(void **data) | 302 | static unsigned long get_sb_block(void **data) |
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index 0f0b1eadb98d..84be02e93652 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -925,7 +925,7 @@ int ext3_get_blocks_handle(handle_t *handle, struct inode *inode, | |||
925 | set_buffer_new(bh_result); | 925 | set_buffer_new(bh_result); |
926 | got_it: | 926 | got_it: |
927 | map_bh(bh_result, inode->i_sb, le32_to_cpu(chain[depth-1].key)); | 927 | map_bh(bh_result, inode->i_sb, le32_to_cpu(chain[depth-1].key)); |
928 | if (blocks_to_boundary == 0) | 928 | if (count > blocks_to_boundary) |
929 | set_buffer_boundary(bh_result); | 929 | set_buffer_boundary(bh_result); |
930 | err = count; | 930 | err = count; |
931 | /* Clean up and exit */ | 931 | /* Clean up and exit */ |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 813d589cc6c0..3559086eee5f 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -554,6 +554,47 @@ static int ext3_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
554 | return 0; | 554 | return 0; |
555 | } | 555 | } |
556 | 556 | ||
557 | |||
558 | static struct dentry *ext3_get_dentry(struct super_block *sb, void *vobjp) | ||
559 | { | ||
560 | __u32 *objp = vobjp; | ||
561 | unsigned long ino = objp[0]; | ||
562 | __u32 generation = objp[1]; | ||
563 | struct inode *inode; | ||
564 | struct dentry *result; | ||
565 | |||
566 | if (ino < EXT3_FIRST_INO(sb) && ino != EXT3_ROOT_INO) | ||
567 | return ERR_PTR(-ESTALE); | ||
568 | if (ino > le32_to_cpu(EXT3_SB(sb)->s_es->s_inodes_count)) | ||
569 | return ERR_PTR(-ESTALE); | ||
570 | |||
571 | /* iget isn't really right if the inode is currently unallocated!! | ||
572 | * | ||
573 | * ext3_read_inode will return a bad_inode if the inode had been | ||
574 | * deleted, so we should be safe. | ||
575 | * | ||
576 | * Currently we don't know the generation for parent directory, so | ||
577 | * a generation of 0 means "accept any" | ||
578 | */ | ||
579 | inode = iget(sb, ino); | ||
580 | if (inode == NULL) | ||
581 | return ERR_PTR(-ENOMEM); | ||
582 | if (is_bad_inode(inode) || | ||
583 | (generation && inode->i_generation != generation)) { | ||
584 | iput(inode); | ||
585 | return ERR_PTR(-ESTALE); | ||
586 | } | ||
587 | /* now to find a dentry. | ||
588 | * If possible, get a well-connected one | ||
589 | */ | ||
590 | result = d_alloc_anon(inode); | ||
591 | if (!result) { | ||
592 | iput(inode); | ||
593 | return ERR_PTR(-ENOMEM); | ||
594 | } | ||
595 | return result; | ||
596 | } | ||
597 | |||
557 | #ifdef CONFIG_QUOTA | 598 | #ifdef CONFIG_QUOTA |
558 | #define QTYPE2NAME(t) ((t)==USRQUOTA?"user":"group") | 599 | #define QTYPE2NAME(t) ((t)==USRQUOTA?"user":"group") |
559 | #define QTYPE2MOPT(on, t) ((t)==USRQUOTA?((on)##USRJQUOTA):((on)##GRPJQUOTA)) | 600 | #define QTYPE2MOPT(on, t) ((t)==USRQUOTA?((on)##USRJQUOTA):((on)##GRPJQUOTA)) |
@@ -622,6 +663,7 @@ static struct super_operations ext3_sops = { | |||
622 | 663 | ||
623 | static struct export_operations ext3_export_ops = { | 664 | static struct export_operations ext3_export_ops = { |
624 | .get_parent = ext3_get_parent, | 665 | .get_parent = ext3_get_parent, |
666 | .get_dentry = ext3_get_dentry, | ||
625 | }; | 667 | }; |
626 | 668 | ||
627 | enum { | 669 | enum { |
diff --git a/fs/jffs2/summary.c b/fs/jffs2/summary.c index c19bd476e8ec..e52cef526d90 100644 --- a/fs/jffs2/summary.c +++ b/fs/jffs2/summary.c | |||
@@ -252,6 +252,11 @@ int jffs2_sum_add_kvec(struct jffs2_sb_info *c, const struct kvec *invecs, | |||
252 | union jffs2_node_union *node; | 252 | union jffs2_node_union *node; |
253 | struct jffs2_eraseblock *jeb; | 253 | struct jffs2_eraseblock *jeb; |
254 | 254 | ||
255 | if (c->summary->sum_size == JFFS2_SUMMARY_NOSUM_SIZE) { | ||
256 | dbg_summary("Summary is disabled for this jeb! Skipping summary info!\n"); | ||
257 | return 0; | ||
258 | } | ||
259 | |||
255 | node = invecs[0].iov_base; | 260 | node = invecs[0].iov_base; |
256 | jeb = &c->blocks[ofs / c->sector_size]; | 261 | jeb = &c->blocks[ofs / c->sector_size]; |
257 | ofs -= jeb->offset; | 262 | ofs -= jeb->offset; |