Commit 1493381f authored by Wang Shilong's avatar Wang Shilong Committed by Chris Mason

Btrfs: use u64 for subvolid when parsing mount options

Although for most time, int is enough for subvolid, we should
ensure safety in theory.
Signed-off-by: default avatarWang Shilong <wangsl.fnst@cn.fujitsu.com>
Reviewed-by: default avatarMiao Xie <miaox@cn.fujitsu.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
parent 2c334e87
...@@ -327,7 +327,7 @@ enum { ...@@ -327,7 +327,7 @@ enum {
static match_table_t tokens = { static match_table_t tokens = {
{Opt_degraded, "degraded"}, {Opt_degraded, "degraded"},
{Opt_subvol, "subvol=%s"}, {Opt_subvol, "subvol=%s"},
{Opt_subvolid, "subvolid=%d"}, {Opt_subvolid, "subvolid=%s"},
{Opt_device, "device=%s"}, {Opt_device, "device=%s"},
{Opt_nodatasum, "nodatasum"}, {Opt_nodatasum, "nodatasum"},
{Opt_nodatacow, "nodatacow"}, {Opt_nodatacow, "nodatacow"},
...@@ -673,8 +673,8 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags, ...@@ -673,8 +673,8 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags,
{ {
substring_t args[MAX_OPT_ARGS]; substring_t args[MAX_OPT_ARGS];
char *device_name, *opts, *orig, *p; char *device_name, *opts, *orig, *p;
char *num = NULL;
int error = 0; int error = 0;
int intarg;
if (!options) if (!options)
return 0; return 0;
...@@ -704,16 +704,14 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags, ...@@ -704,16 +704,14 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags,
} }
break; break;
case Opt_subvolid: case Opt_subvolid:
error = match_int(&args[0], &intarg); num = match_strdup(&args[0]);
if (!error) { if (num) {
goto out; *subvol_objectid = memparse(num, NULL);
} else if (intarg >= 0) { kfree(num);
/* we want the original fs_tree */ /* we want the original fs_tree */
if (!intarg) if (!*subvol_objectid)
*subvol_objectid = *subvol_objectid =
BTRFS_FS_TREE_OBJECTID; BTRFS_FS_TREE_OBJECTID;
else
*subvol_objectid = intarg;
} else { } else {
error = -EINVAL; error = -EINVAL;
goto out; goto out;
......
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