mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Jan Kara <jack@suse.cz>, Chao Yu <yuchao0@huawei.com>
Cc: jack@suse.com, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] quota: propagate error from __dquot_initialize
Date: Thu, 23 Nov 2017 23:29:46 +0800	[thread overview]
Message-ID: <4c9a9dc9-1ea3-8f34-44e8-617680652ca3@kernel.org> (raw)
In-Reply-To: <20171121131837.GI12826@quack2.suse.cz>

On 2017/11/21 21:18, Jan Kara wrote:
> On Fri 17-11-17 10:07:53, Chao Yu wrote:
>> In commit 6184fc0b8dd7 ("quota: Propagate error from ->acquire_dquot()"),
>> we have propagated error from __dquot_initialize to caller, but we forgot
>> to handle such error in add_dquot_ref(), so, currently, during quota
>> accounting information initialization flow, if we failed for some of
>> inodes, we just ignore such error, and do account for others, which is
>> not a good implementation.
>>
>> In this patch, we choose to let user be aware of such error, so after
>> turning on quota successfully, we can make sure all inodes disk usage
>> can be accounted, which will be more reasonable.
> 
> Thanks for the patch! One comment below:
> 
>> @@ -2371,10 +2377,18 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
>>  	dqopt->flags |= dquot_state_flag(flags, type);
>>  	spin_unlock(&dq_state_lock);
>>  
>> -	add_dquot_ref(sb, type);
>> +	error = add_dquot_ref(sb, type);
>> +	if (error)
>> +		goto out_dquot_flags;
>>  
>>  	return 0;
>> -
>> +out_dquot_flags:
>> +	spin_lock(&dq_data_lock);
>> +	dqopt->info[type].dqi_flags &= ~DQF_SYS_FILE;
>> +	spin_unlock(&dq_data_lock);
>> +	spin_lock(&dq_state_lock);
>> +	dqopt->flags &= ~(dquot_state_flag(flags, type));
>> +	spin_unlock(&dq_state_lock);
>>  out_file_init:
>>  	dqopt->files[type] = NULL;
>>  	iput(inode);
> 
> This bail out path is not correct. You have to go through full quota off at
> this point (dquot_disable() function) as some inodes had already quotas
> initialized and can be using them...

Yes, you're right, have updated in v2, please help to check that.

Thanks,

> 
> 								Honza
> 

      reply	other threads:[~2017-11-23 15:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-17  2:07 Chao Yu
2017-11-21 13:18 ` Jan Kara
2017-11-23 15:29   ` Chao Yu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4c9a9dc9-1ea3-8f34-44e8-617680652ca3@kernel.org \
    --to=chao@kernel.org \
    --cc=jack@suse.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yuchao0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®