diff options
Diffstat (limited to 'fs/ext3')
-rw-r--r-- | fs/ext3/acl.h | 3 | ||||
-rw-r--r-- | fs/ext3/balloc.c | 6 | ||||
-rw-r--r-- | fs/ext3/inode.c | 19 | ||||
-rw-r--r-- | fs/ext3/namei.c | 15 |
4 files changed, 26 insertions, 17 deletions
diff --git a/fs/ext3/acl.h b/fs/ext3/acl.h index 92d50b53a933..0d1e6279cbfd 100644 --- a/fs/ext3/acl.h +++ b/fs/ext3/acl.h | |||
@@ -62,9 +62,6 @@ extern int ext3_permission (struct inode *, int, struct nameidata *); | |||
62 | extern int ext3_acl_chmod (struct inode *); | 62 | extern int ext3_acl_chmod (struct inode *); |
63 | extern int ext3_init_acl (handle_t *, struct inode *, struct inode *); | 63 | extern int ext3_init_acl (handle_t *, struct inode *, struct inode *); |
64 | 64 | ||
65 | extern int init_ext3_acl(void); | ||
66 | extern void exit_ext3_acl(void); | ||
67 | |||
68 | #else /* CONFIG_EXT3_FS_POSIX_ACL */ | 65 | #else /* CONFIG_EXT3_FS_POSIX_ACL */ |
69 | #include <linux/sched.h> | 66 | #include <linux/sched.h> |
70 | #define ext3_permission NULL | 67 | #define ext3_permission NULL |
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c index a504a40d6d29..063d994bda0b 100644 --- a/fs/ext3/balloc.c +++ b/fs/ext3/balloc.c | |||
@@ -1269,12 +1269,12 @@ ext3_fsblk_t ext3_new_blocks(handle_t *handle, struct inode *inode, | |||
1269 | goal = le32_to_cpu(es->s_first_data_block); | 1269 | goal = le32_to_cpu(es->s_first_data_block); |
1270 | group_no = (goal - le32_to_cpu(es->s_first_data_block)) / | 1270 | group_no = (goal - le32_to_cpu(es->s_first_data_block)) / |
1271 | EXT3_BLOCKS_PER_GROUP(sb); | 1271 | EXT3_BLOCKS_PER_GROUP(sb); |
1272 | goal_group = group_no; | ||
1273 | retry_alloc: | ||
1272 | gdp = ext3_get_group_desc(sb, group_no, &gdp_bh); | 1274 | gdp = ext3_get_group_desc(sb, group_no, &gdp_bh); |
1273 | if (!gdp) | 1275 | if (!gdp) |
1274 | goto io_error; | 1276 | goto io_error; |
1275 | 1277 | ||
1276 | goal_group = group_no; | ||
1277 | retry: | ||
1278 | free_blocks = le16_to_cpu(gdp->bg_free_blocks_count); | 1278 | free_blocks = le16_to_cpu(gdp->bg_free_blocks_count); |
1279 | /* | 1279 | /* |
1280 | * if there is not enough free blocks to make a new resevation | 1280 | * if there is not enough free blocks to make a new resevation |
@@ -1349,7 +1349,7 @@ retry: | |||
1349 | if (my_rsv) { | 1349 | if (my_rsv) { |
1350 | my_rsv = NULL; | 1350 | my_rsv = NULL; |
1351 | group_no = goal_group; | 1351 | group_no = goal_group; |
1352 | goto retry; | 1352 | goto retry_alloc; |
1353 | } | 1353 | } |
1354 | /* No space left on the device */ | 1354 | /* No space left on the device */ |
1355 | *errp = -ENOSPC; | 1355 | *errp = -ENOSPC; |
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index f804d5e9d60c..c5ee9f0691e3 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -1158,7 +1158,7 @@ retry: | |||
1158 | ret = PTR_ERR(handle); | 1158 | ret = PTR_ERR(handle); |
1159 | goto out; | 1159 | goto out; |
1160 | } | 1160 | } |
1161 | if (test_opt(inode->i_sb, NOBH)) | 1161 | if (test_opt(inode->i_sb, NOBH) && ext3_should_writeback_data(inode)) |
1162 | ret = nobh_prepare_write(page, from, to, ext3_get_block); | 1162 | ret = nobh_prepare_write(page, from, to, ext3_get_block); |
1163 | else | 1163 | else |
1164 | ret = block_prepare_write(page, from, to, ext3_get_block); | 1164 | ret = block_prepare_write(page, from, to, ext3_get_block); |
@@ -1244,7 +1244,7 @@ static int ext3_writeback_commit_write(struct file *file, struct page *page, | |||
1244 | if (new_i_size > EXT3_I(inode)->i_disksize) | 1244 | if (new_i_size > EXT3_I(inode)->i_disksize) |
1245 | EXT3_I(inode)->i_disksize = new_i_size; | 1245 | EXT3_I(inode)->i_disksize = new_i_size; |
1246 | 1246 | ||
1247 | if (test_opt(inode->i_sb, NOBH)) | 1247 | if (test_opt(inode->i_sb, NOBH) && ext3_should_writeback_data(inode)) |
1248 | ret = nobh_commit_write(file, page, from, to); | 1248 | ret = nobh_commit_write(file, page, from, to); |
1249 | else | 1249 | else |
1250 | ret = generic_commit_write(file, page, from, to); | 1250 | ret = generic_commit_write(file, page, from, to); |
@@ -1494,7 +1494,7 @@ static int ext3_writeback_writepage(struct page *page, | |||
1494 | goto out_fail; | 1494 | goto out_fail; |
1495 | } | 1495 | } |
1496 | 1496 | ||
1497 | if (test_opt(inode->i_sb, NOBH)) | 1497 | if (test_opt(inode->i_sb, NOBH) && ext3_should_writeback_data(inode)) |
1498 | ret = nobh_writepage(page, ext3_get_block, wbc); | 1498 | ret = nobh_writepage(page, ext3_get_block, wbc); |
1499 | else | 1499 | else |
1500 | ret = block_write_full_page(page, ext3_get_block, wbc); | 1500 | ret = block_write_full_page(page, ext3_get_block, wbc); |
@@ -2402,14 +2402,15 @@ static ext3_fsblk_t ext3_get_inode_block(struct super_block *sb, | |||
2402 | struct buffer_head *bh; | 2402 | struct buffer_head *bh; |
2403 | struct ext3_group_desc * gdp; | 2403 | struct ext3_group_desc * gdp; |
2404 | 2404 | ||
2405 | 2405 | if (!ext3_valid_inum(sb, ino)) { | |
2406 | if ((ino != EXT3_ROOT_INO && ino != EXT3_JOURNAL_INO && | 2406 | /* |
2407 | ino != EXT3_RESIZE_INO && ino < EXT3_FIRST_INO(sb)) || | 2407 | * This error is already checked for in namei.c unless we are |
2408 | ino > le32_to_cpu(EXT3_SB(sb)->s_es->s_inodes_count)) { | 2408 | * looking at an NFS filehandle, in which case no error |
2409 | ext3_error(sb, "ext3_get_inode_block", | 2409 | * report is needed |
2410 | "bad inode number: %lu", ino); | 2410 | */ |
2411 | return 0; | 2411 | return 0; |
2412 | } | 2412 | } |
2413 | |||
2413 | block_group = (ino - 1) / EXT3_INODES_PER_GROUP(sb); | 2414 | block_group = (ino - 1) / EXT3_INODES_PER_GROUP(sb); |
2414 | if (block_group >= EXT3_SB(sb)->s_groups_count) { | 2415 | if (block_group >= EXT3_SB(sb)->s_groups_count) { |
2415 | ext3_error(sb,"ext3_get_inode_block","group >= groups count"); | 2416 | ext3_error(sb,"ext3_get_inode_block","group >= groups count"); |
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index d9176dba3698..2aa7101b27cd 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c | |||
@@ -1000,7 +1000,12 @@ static struct dentry *ext3_lookup(struct inode * dir, struct dentry *dentry, str | |||
1000 | if (bh) { | 1000 | if (bh) { |
1001 | unsigned long ino = le32_to_cpu(de->inode); | 1001 | unsigned long ino = le32_to_cpu(de->inode); |
1002 | brelse (bh); | 1002 | brelse (bh); |
1003 | inode = iget(dir->i_sb, ino); | 1003 | if (!ext3_valid_inum(dir->i_sb, ino)) { |
1004 | ext3_error(dir->i_sb, "ext3_lookup", | ||
1005 | "bad inode number: %lu", ino); | ||
1006 | inode = NULL; | ||
1007 | } else | ||
1008 | inode = iget(dir->i_sb, ino); | ||
1004 | 1009 | ||
1005 | if (!inode) | 1010 | if (!inode) |
1006 | return ERR_PTR(-EACCES); | 1011 | return ERR_PTR(-EACCES); |
@@ -1028,7 +1033,13 @@ struct dentry *ext3_get_parent(struct dentry *child) | |||
1028 | return ERR_PTR(-ENOENT); | 1033 | return ERR_PTR(-ENOENT); |
1029 | ino = le32_to_cpu(de->inode); | 1034 | ino = le32_to_cpu(de->inode); |
1030 | brelse(bh); | 1035 | brelse(bh); |
1031 | inode = iget(child->d_inode->i_sb, ino); | 1036 | |
1037 | if (!ext3_valid_inum(child->d_inode->i_sb, ino)) { | ||
1038 | ext3_error(child->d_inode->i_sb, "ext3_get_parent", | ||
1039 | "bad inode number: %lu", ino); | ||
1040 | inode = NULL; | ||
1041 | } else | ||
1042 | inode = iget(child->d_inode->i_sb, ino); | ||
1032 | 1043 | ||
1033 | if (!inode) | 1044 | if (!inode) |
1034 | return ERR_PTR(-EACCES); | 1045 | return ERR_PTR(-EACCES); |