mirror of https://gitee.com/openkylin/linux.git
ocfs2: Check heartbeat mode for kernel stacks only
Commit 2c442719e9
added some checks for proper
heartbeat mode when the o2cb stack is running. Unfortunately, it didn't
take into account that a userpsace stack could be running. Fix this by only
doing the check if o2cb is in use. This patch allows userspace stacks to
mount the fs again.
Cc: stable@kernel.org
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Signed-off-by: Joel Becker <jlbec@evilplan.org>
This commit is contained in:
parent
acf3bb007e
commit
52c303c56c
|
@ -1316,7 +1316,7 @@ static int ocfs2_parse_options(struct super_block *sb,
|
||||||
struct mount_options *mopt,
|
struct mount_options *mopt,
|
||||||
int is_remount)
|
int is_remount)
|
||||||
{
|
{
|
||||||
int status;
|
int status, user_stack = 0;
|
||||||
char *p;
|
char *p;
|
||||||
u32 tmp;
|
u32 tmp;
|
||||||
|
|
||||||
|
@ -1459,6 +1459,15 @@ static int ocfs2_parse_options(struct super_block *sb,
|
||||||
memcpy(mopt->cluster_stack, args[0].from,
|
memcpy(mopt->cluster_stack, args[0].from,
|
||||||
OCFS2_STACK_LABEL_LEN);
|
OCFS2_STACK_LABEL_LEN);
|
||||||
mopt->cluster_stack[OCFS2_STACK_LABEL_LEN] = '\0';
|
mopt->cluster_stack[OCFS2_STACK_LABEL_LEN] = '\0';
|
||||||
|
/*
|
||||||
|
* Open code the memcmp here as we don't have
|
||||||
|
* an osb to pass to
|
||||||
|
* ocfs2_userspace_stack().
|
||||||
|
*/
|
||||||
|
if (memcmp(mopt->cluster_stack,
|
||||||
|
OCFS2_CLASSIC_CLUSTER_STACK,
|
||||||
|
OCFS2_STACK_LABEL_LEN))
|
||||||
|
user_stack = 1;
|
||||||
break;
|
break;
|
||||||
case Opt_inode64:
|
case Opt_inode64:
|
||||||
mopt->mount_opt |= OCFS2_MOUNT_INODE64;
|
mopt->mount_opt |= OCFS2_MOUNT_INODE64;
|
||||||
|
@ -1514,13 +1523,16 @@ static int ocfs2_parse_options(struct super_block *sb,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure only one heartbeat mode */
|
if (user_stack == 0) {
|
||||||
tmp = mopt->mount_opt & (OCFS2_MOUNT_HB_LOCAL | OCFS2_MOUNT_HB_GLOBAL |
|
/* Ensure only one heartbeat mode */
|
||||||
OCFS2_MOUNT_HB_NONE);
|
tmp = mopt->mount_opt & (OCFS2_MOUNT_HB_LOCAL |
|
||||||
if (hweight32(tmp) != 1) {
|
OCFS2_MOUNT_HB_GLOBAL |
|
||||||
mlog(ML_ERROR, "Invalid heartbeat mount options\n");
|
OCFS2_MOUNT_HB_NONE);
|
||||||
status = 0;
|
if (hweight32(tmp) != 1) {
|
||||||
goto bail;
|
mlog(ML_ERROR, "Invalid heartbeat mount options\n");
|
||||||
|
status = 0;
|
||||||
|
goto bail;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
status = 1;
|
status = 1;
|
||||||
|
|
Loading…
Reference in New Issue