Commit c05dbfc2 authored by Ryusuke Konishi's avatar Ryusuke Konishi

nilfs2: accept 64-bit checkpoint numbers in cp mount option

The current implementation doesn't mount snapshots with checkpoint
numbers larger than INT_MAX since it uses match_int() for parsing
"cp=" mount option.

This uses simple_strtoull() for the conversion to resolve the issue.
Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
parent 2879ed66
...@@ -556,7 +556,6 @@ static int parse_options(char *options, struct super_block *sb, int is_remount) ...@@ -556,7 +556,6 @@ static int parse_options(char *options, struct super_block *sb, int is_remount)
struct nilfs_sb_info *sbi = NILFS_SB(sb); struct nilfs_sb_info *sbi = NILFS_SB(sb);
char *p; char *p;
substring_t args[MAX_OPT_ARGS]; substring_t args[MAX_OPT_ARGS];
int option;
if (!options) if (!options)
return 1; return 1;
...@@ -594,8 +593,6 @@ static int parse_options(char *options, struct super_block *sb, int is_remount) ...@@ -594,8 +593,6 @@ static int parse_options(char *options, struct super_block *sb, int is_remount)
nilfs_write_opt(sbi, ERROR_MODE, ERRORS_CONT); nilfs_write_opt(sbi, ERROR_MODE, ERRORS_CONT);
break; break;
case Opt_snapshot: case Opt_snapshot:
if (match_int(&args[0], &option) || option <= 0)
return 0;
if (is_remount) { if (is_remount) {
printk(KERN_ERR printk(KERN_ERR
"NILFS: \"%s\" option is invalid " "NILFS: \"%s\" option is invalid "
...@@ -1065,7 +1062,7 @@ static int nilfs_identify(char *data, struct nilfs_super_data *sd) ...@@ -1065,7 +1062,7 @@ static int nilfs_identify(char *data, struct nilfs_super_data *sd)
{ {
char *p, *options = data; char *p, *options = data;
substring_t args[MAX_OPT_ARGS]; substring_t args[MAX_OPT_ARGS];
int option, token; int token;
int ret = 0; int ret = 0;
do { do {
...@@ -1073,18 +1070,20 @@ static int nilfs_identify(char *data, struct nilfs_super_data *sd) ...@@ -1073,18 +1070,20 @@ static int nilfs_identify(char *data, struct nilfs_super_data *sd)
if (p != NULL && *p) { if (p != NULL && *p) {
token = match_token(p, tokens, args); token = match_token(p, tokens, args);
if (token == Opt_snapshot) { if (token == Opt_snapshot) {
if (!(sd->flags & MS_RDONLY)) if (!(sd->flags & MS_RDONLY)) {
ret++; ret++;
else { } else {
ret = match_int(&args[0], &option); sd->cno = simple_strtoull(args[0].from,
if (!ret) { NULL, 0);
if (option > 0) /*
sd->cno = option; * No need to see the end pointer;
else * match_token() has done syntax
* checking.
*/
if (sd->cno == 0)
ret++; ret++;
} }
} }
}
if (ret) if (ret)
printk(KERN_ERR printk(KERN_ERR
"NILFS: invalid mount option: %s\n", p); "NILFS: invalid mount option: %s\n", p);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment