diff options
-rw-r--r-- | fs/ext4/ialloc.c | 6 | ||||
-rw-r--r-- | fs/ext4/inode.c | 7 | ||||
-rw-r--r-- | fs/ext4/namei.c | 63 |
3 files changed, 56 insertions, 20 deletions
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 173c1ae21395..619bfc1fda8c 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -721,7 +721,7 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir, | |||
721 | struct ext4_group_desc *gdp = NULL; | 721 | struct ext4_group_desc *gdp = NULL; |
722 | struct ext4_inode_info *ei; | 722 | struct ext4_inode_info *ei; |
723 | struct ext4_sb_info *sbi; | 723 | struct ext4_sb_info *sbi; |
724 | int ret2, err = 0; | 724 | int ret2, err; |
725 | struct inode *ret; | 725 | struct inode *ret; |
726 | ext4_group_t i; | 726 | ext4_group_t i; |
727 | ext4_group_t flex_group; | 727 | ext4_group_t flex_group; |
@@ -769,7 +769,9 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir, | |||
769 | inode->i_gid = dir->i_gid; | 769 | inode->i_gid = dir->i_gid; |
770 | } else | 770 | } else |
771 | inode_init_owner(inode, dir, mode); | 771 | inode_init_owner(inode, dir, mode); |
772 | dquot_initialize(inode); | 772 | err = dquot_initialize(inode); |
773 | if (err) | ||
774 | goto out; | ||
773 | 775 | ||
774 | if (!goal) | 776 | if (!goal) |
775 | goal = sbi->s_inode_goal; | 777 | goal = sbi->s_inode_goal; |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index cecf9aa10811..fed7ee7ea6e8 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -4661,8 +4661,11 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr) | |||
4661 | if (error) | 4661 | if (error) |
4662 | return error; | 4662 | return error; |
4663 | 4663 | ||
4664 | if (is_quota_modification(inode, attr)) | 4664 | if (is_quota_modification(inode, attr)) { |
4665 | dquot_initialize(inode); | 4665 | error = dquot_initialize(inode); |
4666 | if (error) | ||
4667 | return error; | ||
4668 | } | ||
4666 | if ((ia_valid & ATTR_UID && !uid_eq(attr->ia_uid, inode->i_uid)) || | 4669 | if ((ia_valid & ATTR_UID && !uid_eq(attr->ia_uid, inode->i_uid)) || |
4667 | (ia_valid & ATTR_GID && !gid_eq(attr->ia_gid, inode->i_gid))) { | 4670 | (ia_valid & ATTR_GID && !gid_eq(attr->ia_gid, inode->i_gid))) { |
4668 | handle_t *handle; | 4671 | handle_t *handle; |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 011dcfb5cce3..d3ff83742a33 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -2436,7 +2436,9 @@ static int ext4_create(struct inode *dir, struct dentry *dentry, umode_t mode, | |||
2436 | struct inode *inode; | 2436 | struct inode *inode; |
2437 | int err, credits, retries = 0; | 2437 | int err, credits, retries = 0; |
2438 | 2438 | ||
2439 | dquot_initialize(dir); | 2439 | err = dquot_initialize(dir); |
2440 | if (err) | ||
2441 | return err; | ||
2440 | 2442 | ||
2441 | credits = (EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + | 2443 | credits = (EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + |
2442 | EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3); | 2444 | EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3); |
@@ -2470,7 +2472,9 @@ static int ext4_mknod(struct inode *dir, struct dentry *dentry, | |||
2470 | if (!new_valid_dev(rdev)) | 2472 | if (!new_valid_dev(rdev)) |
2471 | return -EINVAL; | 2473 | return -EINVAL; |
2472 | 2474 | ||
2473 | dquot_initialize(dir); | 2475 | err = dquot_initialize(dir); |
2476 | if (err) | ||
2477 | return err; | ||
2474 | 2478 | ||
2475 | credits = (EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + | 2479 | credits = (EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + |
2476 | EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3); | 2480 | EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3); |
@@ -2499,7 +2503,9 @@ static int ext4_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
2499 | struct inode *inode; | 2503 | struct inode *inode; |
2500 | int err, retries = 0; | 2504 | int err, retries = 0; |
2501 | 2505 | ||
2502 | dquot_initialize(dir); | 2506 | err = dquot_initialize(dir); |
2507 | if (err) | ||
2508 | return err; | ||
2503 | 2509 | ||
2504 | retry: | 2510 | retry: |
2505 | inode = ext4_new_inode_start_handle(dir, mode, | 2511 | inode = ext4_new_inode_start_handle(dir, mode, |
@@ -2612,7 +2618,9 @@ static int ext4_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
2612 | if (EXT4_DIR_LINK_MAX(dir)) | 2618 | if (EXT4_DIR_LINK_MAX(dir)) |
2613 | return -EMLINK; | 2619 | return -EMLINK; |
2614 | 2620 | ||
2615 | dquot_initialize(dir); | 2621 | err = dquot_initialize(dir); |
2622 | if (err) | ||
2623 | return err; | ||
2616 | 2624 | ||
2617 | credits = (EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + | 2625 | credits = (EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + |
2618 | EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3); | 2626 | EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3); |
@@ -2910,8 +2918,12 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry) | |||
2910 | 2918 | ||
2911 | /* Initialize quotas before so that eventual writes go in | 2919 | /* Initialize quotas before so that eventual writes go in |
2912 | * separate transaction */ | 2920 | * separate transaction */ |
2913 | dquot_initialize(dir); | 2921 | retval = dquot_initialize(dir); |
2914 | dquot_initialize(d_inode(dentry)); | 2922 | if (retval) |
2923 | return retval; | ||
2924 | retval = dquot_initialize(d_inode(dentry)); | ||
2925 | if (retval) | ||
2926 | return retval; | ||
2915 | 2927 | ||
2916 | retval = -ENOENT; | 2928 | retval = -ENOENT; |
2917 | bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); | 2929 | bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); |
@@ -2980,8 +2992,12 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry) | |||
2980 | trace_ext4_unlink_enter(dir, dentry); | 2992 | trace_ext4_unlink_enter(dir, dentry); |
2981 | /* Initialize quotas before so that eventual writes go | 2993 | /* Initialize quotas before so that eventual writes go |
2982 | * in separate transaction */ | 2994 | * in separate transaction */ |
2983 | dquot_initialize(dir); | 2995 | retval = dquot_initialize(dir); |
2984 | dquot_initialize(d_inode(dentry)); | 2996 | if (retval) |
2997 | return retval; | ||
2998 | retval = dquot_initialize(d_inode(dentry)); | ||
2999 | if (retval) | ||
3000 | return retval; | ||
2985 | 3001 | ||
2986 | retval = -ENOENT; | 3002 | retval = -ENOENT; |
2987 | bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); | 3003 | bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); |
@@ -3066,7 +3082,9 @@ static int ext4_symlink(struct inode *dir, | |||
3066 | goto err_free_sd; | 3082 | goto err_free_sd; |
3067 | } | 3083 | } |
3068 | 3084 | ||
3069 | dquot_initialize(dir); | 3085 | err = dquot_initialize(dir); |
3086 | if (err) | ||
3087 | return err; | ||
3070 | 3088 | ||
3071 | if ((disk_link.len > EXT4_N_BLOCKS * 4)) { | 3089 | if ((disk_link.len > EXT4_N_BLOCKS * 4)) { |
3072 | /* | 3090 | /* |
@@ -3197,7 +3215,9 @@ static int ext4_link(struct dentry *old_dentry, | |||
3197 | if (ext4_encrypted_inode(dir) && | 3215 | if (ext4_encrypted_inode(dir) && |
3198 | !ext4_is_child_context_consistent_with_parent(dir, inode)) | 3216 | !ext4_is_child_context_consistent_with_parent(dir, inode)) |
3199 | return -EPERM; | 3217 | return -EPERM; |
3200 | dquot_initialize(dir); | 3218 | err = dquot_initialize(dir); |
3219 | if (err) | ||
3220 | return err; | ||
3201 | 3221 | ||
3202 | retry: | 3222 | retry: |
3203 | handle = ext4_journal_start(dir, EXT4_HT_DIR, | 3223 | handle = ext4_journal_start(dir, EXT4_HT_DIR, |
@@ -3476,13 +3496,20 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
3476 | int credits; | 3496 | int credits; |
3477 | u8 old_file_type; | 3497 | u8 old_file_type; |
3478 | 3498 | ||
3479 | dquot_initialize(old.dir); | 3499 | retval = dquot_initialize(old.dir); |
3480 | dquot_initialize(new.dir); | 3500 | if (retval) |
3501 | return retval; | ||
3502 | retval = dquot_initialize(new.dir); | ||
3503 | if (retval) | ||
3504 | return retval; | ||
3481 | 3505 | ||
3482 | /* Initialize quotas before so that eventual writes go | 3506 | /* Initialize quotas before so that eventual writes go |
3483 | * in separate transaction */ | 3507 | * in separate transaction */ |
3484 | if (new.inode) | 3508 | if (new.inode) { |
3485 | dquot_initialize(new.inode); | 3509 | retval = dquot_initialize(new.inode); |
3510 | if (retval) | ||
3511 | return retval; | ||
3512 | } | ||
3486 | 3513 | ||
3487 | old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, &old.de, NULL); | 3514 | old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, &old.de, NULL); |
3488 | if (IS_ERR(old.bh)) | 3515 | if (IS_ERR(old.bh)) |
@@ -3678,8 +3705,12 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
3678 | new.inode))) | 3705 | new.inode))) |
3679 | return -EPERM; | 3706 | return -EPERM; |
3680 | 3707 | ||
3681 | dquot_initialize(old.dir); | 3708 | retval = dquot_initialize(old.dir); |
3682 | dquot_initialize(new.dir); | 3709 | if (retval) |
3710 | return retval; | ||
3711 | retval = dquot_initialize(new.dir); | ||
3712 | if (retval) | ||
3713 | return retval; | ||
3683 | 3714 | ||
3684 | old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, | 3715 | old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, |
3685 | &old.de, &old.inlined); | 3716 | &old.de, &old.inlined); |