mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-30 12:44:39 +00:00
agent: clear MsFlags if the option has clear flag set
'FLAGS' hash map has bool to indicate if the flag should be cleared or not. But in parse_mount_flags_and_options() we set the flag even 'clear' is true. This results in a 'rw' mount being mounted as 'MS_RDONLY'. Fixes: #2262 Signed-off-by: Eryu Guan <eguan@linux.alibaba.com>
This commit is contained in:
parent
594ff3a5bd
commit
35cbc93dee
@ -549,9 +549,13 @@ fn parse_mount_flags_and_options(options_vec: Vec<&str>) -> (MsFlags, String) {
|
|||||||
if !opt.is_empty() {
|
if !opt.is_empty() {
|
||||||
match FLAGS.get(opt) {
|
match FLAGS.get(opt) {
|
||||||
Some(x) => {
|
Some(x) => {
|
||||||
let (_, f) = *x;
|
let (clear, f) = *x;
|
||||||
|
if clear {
|
||||||
|
flags &= !f;
|
||||||
|
} else {
|
||||||
flags |= f;
|
flags |= f;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
None => {
|
None => {
|
||||||
if !options.is_empty() {
|
if !options.is_empty() {
|
||||||
options.push_str(format!(",{}", opt).as_str());
|
options.push_str(format!(",{}", opt).as_str());
|
||||||
|
@ -121,8 +121,12 @@ impl Namespace {
|
|||||||
let mut flags = MsFlags::empty();
|
let mut flags = MsFlags::empty();
|
||||||
|
|
||||||
if let Some(x) = FLAGS.get("rbind") {
|
if let Some(x) = FLAGS.get("rbind") {
|
||||||
let (_, f) = *x;
|
let (clear, f) = *x;
|
||||||
|
if clear {
|
||||||
|
flags &= !f;
|
||||||
|
} else {
|
||||||
flags |= f;
|
flags |= f;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let bare_mount = BareMount::new(source, destination, "none", flags, "", &logger);
|
let bare_mount = BareMount::new(source, destination, "none", flags, "", &logger);
|
||||||
|
Loading…
Reference in New Issue
Block a user