diff mbox series

ext4: fix to detect failure of dquot_initialize in project ioctl

Message ID 1536623701-5961-1-git-send-email-wshilong1991@gmail.com
State Superseded
Headers show
Series ext4: fix to detect failure of dquot_initialize in project ioctl | expand

Commit Message

Wang Shilong Sept. 10, 2018, 11:55 p.m. UTC
From: Wang Shilong <wshilong@ddn.com>

We return most of failure of dquota_initialize() except
inode evict, this could make a bit sense, for example
we allow file removal even quota files are broken?

But it dosen't make sense to allow setting project
if quota files etc are broken.

Signed-off-by: Wang Shilong <wshilong@ddn.com>
---
This patch based on:
https://patchwork.ozlabs.org/patch/967727/
---
 fs/ext4/ioctl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Andreas Dilger Sept. 11, 2018, 12:29 a.m. UTC | #1
> On Sep 10, 2018, at 5:55 PM, Wang Shilong <wangshilong1991@gmail.com> wrote:
> 
> From: Wang Shilong <wshilong@ddn.com>
> 
> We return most of failure of dquota_initialize() except
> inode evict, this could make a bit sense, for example
> we allow file removal even quota files are broken?
> 
> But it dosen't make sense to allow setting project
> if quota files etc are broken.
> 
> Signed-off-by: Wang Shilong <wshilong@ddn.com>
> ---
> This patch based on:
> https://patchwork.ozlabs.org/patch/967727/
> ---
> fs/ext4/ioctl.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
> index 6ef989a..2f0bb90 100644
> --- a/fs/ext4/ioctl.c
> +++ b/fs/ext4/ioctl.c
> @@ -359,7 +359,9 @@ static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
> 		brelse(iloc.bh);
> 	}
> 
> -	dquot_initialize(inode);
> +	err = dquot_initialize(inode);
> +	if (err)
> +		return err;

(defect) this should use "goto out_unlock;" like the other error handling here.


Cheers, Andreas
Wang Shilong Sept. 11, 2018, 12:38 a.m. UTC | #2
> 在 2018年9月11日,上午8:29,Andreas Dilger <adilger@dilger.ca> 写道:
> 
> 
>> On Sep 10, 2018, at 5:55 PM, Wang Shilong <wangshilong1991@gmail.com> wrote:
>> 
>> From: Wang Shilong <wshilong@ddn.com>
>> 
>> We return most of failure of dquota_initialize() except
>> inode evict, this could make a bit sense, for example
>> we allow file removal even quota files are broken?
>> 
>> But it dosen't make sense to allow setting project
>> if quota files etc are broken.
>> 
>> Signed-off-by: Wang Shilong <wshilong@ddn.com>
>> ---
>> This patch based on:
>> https://patchwork.ozlabs.org/patch/967727/

You missed this part ^_^

>> ---
>> fs/ext4/ioctl.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>> 
>> diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
>> index 6ef989a..2f0bb90 100644
>> --- a/fs/ext4/ioctl.c
>> +++ b/fs/ext4/ioctl.c
>> @@ -359,7 +359,9 @@ static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
>> 		brelse(iloc.bh);
>> 	}
>> 
>> -	dquot_initialize(inode);
>> +	err = dquot_initialize(inode);
>> +	if (err)
>> +		return err;
> 
> (defect) this should use "goto out_unlock;" like the other error handling here.

Hey Andreas,

As I mentioned this patch is based on.
https://patchwork.ozlabs.org/patch/967728/

Which removed out_unlock label.


> 
> 
> Cheers, Andreas
> 
> 
> 
> 
>
diff mbox series

Patch

diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index 6ef989a..2f0bb90 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -359,7 +359,9 @@  static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
 		brelse(iloc.bh);
 	}
 
-	dquot_initialize(inode);
+	err = dquot_initialize(inode);
+	if (err)
+		return err;
 
 	handle = ext4_journal_start(inode, EXT4_HT_QUOTA,
 		EXT4_QUOTA_INIT_BLOCKS(sb) +