linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext2: initialize quota info in ext2_xattr_set()
@ 2020-06-26  5:49 Chengguang Xu
  2020-07-08 10:52 ` Ritesh Harjani
  0 siblings, 1 reply; 4+ messages in thread
From: Chengguang Xu @ 2020-06-26  5:49 UTC (permalink / raw)
  To: jack; +Cc: linux-ext4, Chengguang Xu

In order to correctly account/limit space usage, should initialize
quota info before calling quota related functions.

Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
---
 fs/ext2/xattr.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index 943cc469f42f..913e5c4921ec 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -437,6 +437,9 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name,
 	name_len = strlen(name);
 	if (name_len > 255 || value_len > sb->s_blocksize)
 		return -ERANGE;
+	error = dquot_initialize(inode);
+	if (error)
+		return error;
 	down_write(&EXT2_I(inode)->xattr_sem);
 	if (EXT2_I(inode)->i_file_acl) {
 		/* The inode already has an extended attribute block. */
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ext2: initialize quota info in ext2_xattr_set()
  2020-06-26  5:49 [PATCH] ext2: initialize quota info in ext2_xattr_set() Chengguang Xu
@ 2020-07-08 10:52 ` Ritesh Harjani
  2020-07-08 11:20   ` Jan Kara
  2020-07-11  7:27   ` Chengguang Xu
  0 siblings, 2 replies; 4+ messages in thread
From: Ritesh Harjani @ 2020-07-08 10:52 UTC (permalink / raw)
  To: Chengguang Xu, jack; +Cc: linux-ext4



On 6/26/20 11:19 AM, Chengguang Xu wrote:
> In order to correctly account/limit space usage, should initialize
> quota info before calling quota related functions.

How did you encounter the problem?
Any test case got hit?

> 
> Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>

LGTM, feel free to add
Reviewed-by: Reviewed-by: Ritesh Harjani <riteshh@linux.ibm.com>


> ---
>   fs/ext2/xattr.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
> index 943cc469f42f..913e5c4921ec 100644
> --- a/fs/ext2/xattr.c
> +++ b/fs/ext2/xattr.c
> @@ -437,6 +437,9 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name,
>   	name_len = strlen(name);
>   	if (name_len > 255 || value_len > sb->s_blocksize)
>   		return -ERANGE;
> +	error = dquot_initialize(inode);
> +	if (error)
> +		return error;
>   	down_write(&EXT2_I(inode)->xattr_sem);
>   	if (EXT2_I(inode)->i_file_acl) {
>   		/* The inode already has an extended attribute block. */
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ext2: initialize quota info in ext2_xattr_set()
  2020-07-08 10:52 ` Ritesh Harjani
@ 2020-07-08 11:20   ` Jan Kara
  2020-07-11  7:27   ` Chengguang Xu
  1 sibling, 0 replies; 4+ messages in thread
From: Jan Kara @ 2020-07-08 11:20 UTC (permalink / raw)
  To: Ritesh Harjani; +Cc: Chengguang Xu, jack, linux-ext4

On Wed 08-07-20 16:22:01, Ritesh Harjani wrote:
> 
> 
> On 6/26/20 11:19 AM, Chengguang Xu wrote:
> > In order to correctly account/limit space usage, should initialize
> > quota info before calling quota related functions.
> 
> How did you encounter the problem?
> Any test case got hit?
> 
> > 
> > Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
> 
> LGTM, feel free to add
> Reviewed-by: Reviewed-by: Ritesh Harjani <riteshh@linux.ibm.com>

Thanks. I've added the patch to my tree.

								Honza

> 
> 
> > ---
> >   fs/ext2/xattr.c | 3 +++
> >   1 file changed, 3 insertions(+)
> > 
> > diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
> > index 943cc469f42f..913e5c4921ec 100644
> > --- a/fs/ext2/xattr.c
> > +++ b/fs/ext2/xattr.c
> > @@ -437,6 +437,9 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name,
> >   	name_len = strlen(name);
> >   	if (name_len > 255 || value_len > sb->s_blocksize)
> >   		return -ERANGE;
> > +	error = dquot_initialize(inode);
> > +	if (error)
> > +		return error;
> >   	down_write(&EXT2_I(inode)->xattr_sem);
> >   	if (EXT2_I(inode)->i_file_acl) {
> >   		/* The inode already has an extended attribute block. */
> > 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ext2: initialize quota info in ext2_xattr_set()
  2020-07-08 10:52 ` Ritesh Harjani
  2020-07-08 11:20   ` Jan Kara
@ 2020-07-11  7:27   ` Chengguang Xu
  1 sibling, 0 replies; 4+ messages in thread
From: Chengguang Xu @ 2020-07-11  7:27 UTC (permalink / raw)
  To: Ritesh Harjani, jack; +Cc: linux-ext4

在 7/8/2020 6:52 PM, Ritesh Harjani 写道:
>
>
> On 6/26/20 11:19 AM, Chengguang Xu wrote:
>> In order to correctly account/limit space usage, should initialize
>> quota info before calling quota related functions.
>
> How did you encounter the problem?
> Any test case got hit?

I found the issue by code inspecting when I was learning mbcache logic.

Thanks,
cgxu

>
>>
>> Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
>
> LGTM, feel free to add
> Reviewed-by: Reviewed-by: Ritesh Harjani <riteshh@linux.ibm.com>
>
>
>> ---
>>   fs/ext2/xattr.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
>> index 943cc469f42f..913e5c4921ec 100644
>> --- a/fs/ext2/xattr.c
>> +++ b/fs/ext2/xattr.c
>> @@ -437,6 +437,9 @@ ext2_xattr_set(struct inode *inode, int 
>> name_index, const char *name,
>>       name_len = strlen(name);
>>       if (name_len > 255 || value_len > sb->s_blocksize)
>>           return -ERANGE;
>> +    error = dquot_initialize(inode);
>> +    if (error)
>> +        return error;
>>       down_write(&EXT2_I(inode)->xattr_sem);
>>       if (EXT2_I(inode)->i_file_acl) {
>>           /* The inode already has an extended attribute block. */
>>



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-11  7:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-26  5:49 [PATCH] ext2: initialize quota info in ext2_xattr_set() Chengguang Xu
2020-07-08 10:52 ` Ritesh Harjani
2020-07-08 11:20   ` Jan Kara
2020-07-11  7:27   ` Chengguang Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).