Commit be4acd9d authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Pavel Emelyanov

fix parse_mnt_flags() to dump/restore STRICTATIME correctly

CRIU always retores the mounts as MNT_RELATIME. This is because the
kernel uses this mode by default, so we need to pass MS_STRICTATIME
explicitely if we didn't see "noatime" or "MS_RELATIME".

While at it, make mnt_opt2flag[] and sb_opt2flag "static", otherwise
gcc actually creates these arrays on stack even if there are "const".
Signed-off-by: 's avatarOleg Nesterov <oleg@redhat.com>
Reviewed-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 25267e5b
......@@ -878,7 +878,7 @@ static int do_opt2flag(char *opt, unsigned *flags,
static int parse_mnt_flags(char *opt, unsigned *flags)
{
const struct opt2flag mnt_opt2flag[] = {
static const struct opt2flag mnt_opt2flag[] = {
{ "rw", 0, },
{ "ro", MS_RDONLY, },
{ "nosuid", MS_NOSUID, },
......@@ -890,12 +890,19 @@ static int parse_mnt_flags(char *opt, unsigned *flags)
{ },
};
return do_opt2flag(opt, flags, mnt_opt2flag, NULL);
if (do_opt2flag(opt, flags, mnt_opt2flag, NULL))
return -1;
/* Otherwise the kernel assumes RELATIME by default */
if ((*flags & (MS_RELATIME | MS_NOATIME)) == 0)
*flags = MS_STRICTATIME;
return 0;
}
static int parse_sb_opt(char *opt, unsigned *flags, char *uopt)
{
const struct opt2flag sb_opt2flag[] = {
static const struct opt2flag sb_opt2flag[] = {
{ "rw", 0, },
{ "ro", MS_RDONLY, },
{ "sync", MS_SYNC, },
......
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