All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] quota: be aware of error from dquot_initialize
@ 2017-11-13  3:31 Chao Yu
  2017-11-13  9:18 ` Jan Kara
  0 siblings, 1 reply; 5+ messages in thread
From: Chao Yu @ 2017-11-13  3:31 UTC (permalink / raw)
  To: jack; +Cc: linux-kernel, chao, Chao Yu

Commit 6184fc0b8dd7 ("quota: Propagate error from ->acquire_dquot()")
missed to handle error from dquot_initialize in dquot_file_open, fix it.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 fs/quota/dquot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 50b0556a124f..80002c094647 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -2133,7 +2133,7 @@ int dquot_file_open(struct inode *inode, struct file *file)
 
 	error = generic_file_open(inode, file);
 	if (!error && (file->f_mode & FMODE_WRITE))
-		dquot_initialize(inode);
+		error = dquot_initialize(inode);
 	return error;
 }
 EXPORT_SYMBOL(dquot_file_open);
-- 
2.15.0.55.gc2ece9dc4de6

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

* Re: [PATCH] quota: be aware of error from dquot_initialize
  2017-11-13  3:31 [PATCH] quota: be aware of error from dquot_initialize Chao Yu
@ 2017-11-13  9:18 ` Jan Kara
  2017-11-14  3:43   ` Chao Yu
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kara @ 2017-11-13  9:18 UTC (permalink / raw)
  To: Chao Yu; +Cc: jack, linux-kernel, chao

On Mon 13-11-17 11:31:48, Chao Yu wrote:
> Commit 6184fc0b8dd7 ("quota: Propagate error from ->acquire_dquot()")
> missed to handle error from dquot_initialize in dquot_file_open, fix it.
> 
> Signed-off-by: Chao Yu <yuchao0@huawei.com>

Good spotting. I've added the patch to my tree.

								Honza

> ---
>  fs/quota/dquot.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
> index 50b0556a124f..80002c094647 100644
> --- a/fs/quota/dquot.c
> +++ b/fs/quota/dquot.c
> @@ -2133,7 +2133,7 @@ int dquot_file_open(struct inode *inode, struct file *file)
>  
>  	error = generic_file_open(inode, file);
>  	if (!error && (file->f_mode & FMODE_WRITE))
> -		dquot_initialize(inode);
> +		error = dquot_initialize(inode);
>  	return error;
>  }
>  EXPORT_SYMBOL(dquot_file_open);
> -- 
> 2.15.0.55.gc2ece9dc4de6
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

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

* Re: [PATCH] quota: be aware of error from dquot_initialize
  2017-11-13  9:18 ` Jan Kara
@ 2017-11-14  3:43   ` Chao Yu
  2017-11-14  9:24     ` Jan Kara
  0 siblings, 1 reply; 5+ messages in thread
From: Chao Yu @ 2017-11-14  3:43 UTC (permalink / raw)
  To: Jan Kara; +Cc: jack, linux-kernel, chao

On 2017/11/13 17:18, Jan Kara wrote:
> On Mon 13-11-17 11:31:48, Chao Yu wrote:
>> Commit 6184fc0b8dd7 ("quota: Propagate error from ->acquire_dquot()")
>> missed to handle error from dquot_initialize in dquot_file_open, fix it.
>>
>> Signed-off-by: Chao Yu <yuchao0@huawei.com>
> 
> Good spotting. I've added the patch to my tree.

Thanks for queuing the patch. :)

BTW, I notice in add_dquot_ref we also didn't handle error of
__dquot_initialize, should we handle it too?

Thanks,

> 
> 								Honza
> 
>> ---
>>  fs/quota/dquot.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
>> index 50b0556a124f..80002c094647 100644
>> --- a/fs/quota/dquot.c
>> +++ b/fs/quota/dquot.c
>> @@ -2133,7 +2133,7 @@ int dquot_file_open(struct inode *inode, struct file *file)
>>  
>>  	error = generic_file_open(inode, file);
>>  	if (!error && (file->f_mode & FMODE_WRITE))
>> -		dquot_initialize(inode);
>> +		error = dquot_initialize(inode);
>>  	return error;
>>  }
>>  EXPORT_SYMBOL(dquot_file_open);
>> -- 
>> 2.15.0.55.gc2ece9dc4de6
>>
>>

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

* Re: [PATCH] quota: be aware of error from dquot_initialize
  2017-11-14  3:43   ` Chao Yu
@ 2017-11-14  9:24     ` Jan Kara
  2017-11-17  2:10       ` Chao Yu
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kara @ 2017-11-14  9:24 UTC (permalink / raw)
  To: Chao Yu; +Cc: Jan Kara, jack, linux-kernel, chao

On Tue 14-11-17 11:43:49, Chao Yu wrote:
> On 2017/11/13 17:18, Jan Kara wrote:
> > On Mon 13-11-17 11:31:48, Chao Yu wrote:
> >> Commit 6184fc0b8dd7 ("quota: Propagate error from ->acquire_dquot()")
> >> missed to handle error from dquot_initialize in dquot_file_open, fix it.
> >>
> >> Signed-off-by: Chao Yu <yuchao0@huawei.com>
> > 
> > Good spotting. I've added the patch to my tree.
> 
> Thanks for queuing the patch. :)
> 
> BTW, I notice in add_dquot_ref we also didn't handle error of
> __dquot_initialize, should we handle it too?

It is questionable what we should do with an error in add_dquot_ref(). User
asked us to turn quotas on - that succeeded just fine but then we walked
over already active inodes in add_dquot_ref(), wanted to initialize
accounting information, and that failed for some inode. We can just leave
quota on, the accounting will work for other inodes - that's what we do
now. We could also propagate the failure up and refuse to turn quotas off.
I guess that's a somewhat better approach so if you want to implement that,
go ahead.

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

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

* Re: [PATCH] quota: be aware of error from dquot_initialize
  2017-11-14  9:24     ` Jan Kara
@ 2017-11-17  2:10       ` Chao Yu
  0 siblings, 0 replies; 5+ messages in thread
From: Chao Yu @ 2017-11-17  2:10 UTC (permalink / raw)
  To: Jan Kara; +Cc: jack, linux-kernel, chao

On 2017/11/14 17:24, Jan Kara wrote:
> On Tue 14-11-17 11:43:49, Chao Yu wrote:
>> On 2017/11/13 17:18, Jan Kara wrote:
>>> On Mon 13-11-17 11:31:48, Chao Yu wrote:
>>>> Commit 6184fc0b8dd7 ("quota: Propagate error from ->acquire_dquot()")
>>>> missed to handle error from dquot_initialize in dquot_file_open, fix it.
>>>>
>>>> Signed-off-by: Chao Yu <yuchao0@huawei.com>
>>>
>>> Good spotting. I've added the patch to my tree.
>>
>> Thanks for queuing the patch. :)
>>
>> BTW, I notice in add_dquot_ref we also didn't handle error of
>> __dquot_initialize, should we handle it too?
> 
> It is questionable what we should do with an error in add_dquot_ref(). User
> asked us to turn quotas on - that succeeded just fine but then we walked
> over already active inodes in add_dquot_ref(), wanted to initialize
> accounting information, and that failed for some inode. We can just leave
> quota on, the accounting will work for other inodes - that's what we do
> now. We could also propagate the failure up and refuse to turn quotas off.
> I guess that's a somewhat better approach so if you want to implement that,
> go ahead.

Sorry for the delay.

Have sent one patch to fix this issue, could you please take a look at it?

Thanks,

> 
> 								Honza
> 

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

end of thread, other threads:[~2017-11-17  2:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-13  3:31 [PATCH] quota: be aware of error from dquot_initialize Chao Yu
2017-11-13  9:18 ` Jan Kara
2017-11-14  3:43   ` Chao Yu
2017-11-14  9:24     ` Jan Kara
2017-11-17  2:10       ` Chao Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.