Linux-EROFS Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: gaoxiang25@huawei.com (Gao Xiang)
Subject: [PATCH v3 4/4] staging: erofs: option validation in remount
Date: Wed, 19 Sep 2018 14:56:02 +0800	[thread overview]
Message-ID: <3a269f2e-bfda-ca96-65ee-7dc0fa457ddd@huawei.com> (raw)
In-Reply-To: <79e182ea-9571-8c20-aafe-59e55b7db638@aol.com>

Hi Chengguang,

On 2018/9/19 0:58, Gao Xiang wrote:
> Hi Chengguang,
> 
> On 2018/9/18 23:10, Chengguang Xu wrote:
>> Add option validation in remount. After this patch, remount
>> can change recognized options, and for unknown options remount
>> will fail and report error.
>>
>> Signed-off-by: Chengguang Xu <cgxu519 at gmx.com>
>> Reviewed-by: Chao Yu <yuchao0 at huawei.com>
>> ---
>>  drivers/staging/erofs/super.c | 38 ++++++++++++++++++++++++++++-------
>>  1 file changed, 31 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/staging/erofs/super.c b/drivers/staging/erofs/super.c
>> index a091b93190e1..30b6b44dc6c4 100644
>> --- a/drivers/staging/erofs/super.c
>> +++ b/drivers/staging/erofs/super.c
>> @@ -145,14 +145,10 @@ char *erofs_fault_name[FAULT_MAX] = {
>>  	[FAULT_KMALLOC]		= "kmalloc",
>>  };
>>  
>> -static int erofs_build_fault_attr(struct erofs_sb_info *sbi,
>> -					substring_t *args)
>> +static void __erofs_build_fault_attr(struct erofs_sb_info *sbi,
>> +						unsigned int rate)
>>  {
>>  	struct erofs_fault_info *ffi = &sbi->fault_info;
>> -	int rate = 0;
>> -
>> -	if (args->from && match_int(args, &rate))
>> -		return -EINVAL;
>>  
>>  	if (rate) {
>>  		atomic_set(&ffi->inject_ops, 0);
>> @@ -163,14 +159,29 @@ static int erofs_build_fault_attr(struct erofs_sb_info *sbi,
>>  	}
>>  
>>  	set_opt(sbi, FAULT_INJECTION);
>> -	return 0;
>>  }
>>  
>>  static unsigned int erofs_get_fault_rate(struct erofs_sb_info *sbi)
>>  {
>>  	return sbi->fault_info.inject_rate;
>>  }
>> +
>> +static int erofs_build_fault_attr(struct erofs_sb_info *sbi, substring_t *args)
>> +{
>> +	int rate = 0;
>> +
>> +	if (args->from && match_int(args, &rate))
>> +		return -EINVAL;
>> +
>> +	__erofs_build_fault_attr(sbi, rate);
>> +	return 0;
>> +}
>>  #else
>> +static void __erofs_build_fault_attr(struct erofs_sb_info *sbi,
>> +						unsigned int rate)
>> +{
>> +}
>> +
>>  static int erofs_build_fault_attr(struct erofs_sb_info *sbi,
>>  					substring_t *args)
>>  {
>> @@ -644,10 +655,23 @@ static int erofs_show_options(struct seq_file *seq, struct dentry *root)
>>  
>>  static int erofs_remount(struct super_block *sb, int *flags, char *data)
>>  {
>> +	struct erofs_sb_info *sbi = EROFS_SB(sb);
>> +	unsigned int org_mnt_opt = sbi->mount_opt;
>> +	unsigned int org_inject_rate = erofs_get_fault_rate(sbi);
>> +	int err;
>> +
>>  	BUG_ON(!sb_rdonly(sb));
>> +	err = parse_options(sb, data);
>> +	if (err)
>> +		goto out;
>>  
>>  	*flags |= MS_RDONLY;
> I cannot apply this patch since the above line has been changed in
> 5f0abea6ab6d("staging: erofs: rename superblock flags (MS_xyz -> SB_xyz)").
> 
> 
> And two more checkpatch CHECKs as [PATCH v3 2/4]
> 
> CHECK: Alignment should match open parenthesis
> #141: FILE: drivers/staging/erofs/super.c:149:
> +static void __erofs_build_fault_attr(struct erofs_sb_info *sbi,
> +                                               unsigned int rate)
> 
> CHECK: Alignment should match open parenthesis
> #175: FILE: drivers/staging/erofs/super.c:181:
> +static void __erofs_build_fault_attr(struct erofs_sb_info *sbi,
> +                                               unsigned int rate)
> 
> And I think I need to test the basic erofs remount function tomorrow
> before merging... it is too late and I have to go to sleep now.
I tested just now, and seems good. :)

Reviewed-by: Gao Xiang <gaoxiang25 at huawei.com>

and look forward to your final patchset.

Thanks,
Gao Xiang

      reply	other threads:[~2018-09-19  6:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-18 15:10 [PATCH v3 0/4] staging: erofs: option validation for remount and some code cleanups Chengguang Xu
2018-09-18 15:10 ` [PATCH v3 1/4] staging: erofs: code cleanup for erofs_kmalloc() Chengguang Xu
2018-09-18 15:10 ` [PATCH v3 2/4] staging: erofs: code cleanup for option parsing of fault_injection Chengguang Xu
2018-09-18 16:36   ` Gao Xiang
2018-09-18 15:10 ` [PATCH v3 3/4] staging: erofs: code cleanup for erofs_show_options() Chengguang Xu
2018-09-18 16:39   ` Gao Xiang
2018-09-18 15:10 ` [PATCH v3 4/4] staging: erofs: option validation in remount Chengguang Xu
2018-09-18 16:58   ` Gao Xiang
2018-09-19  6:56     ` Gao Xiang [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=3a269f2e-bfda-ca96-65ee-7dc0fa457ddd@huawei.com \
    --to=gaoxiang25@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