Skip to content

Commit 87716b9

Browse files
committed
mnt_newapi: use FSCONFIG_SET_STRING for key=value mount options
createFilesystemMount() passed all mount options via FSCONFIG_SET_FLAG, which fails for key=value parameters (e.g. size=67108864). Detect '=' in each option and dispatch to FSCONFIG_SET_STRING with separate key and value arguments.
1 parent 50a713b commit 87716b9

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

mnt_newapi.cc

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,24 @@ static int createFilesystemMount(const mount_t& mpt) {
184184
if (opt.empty()) {
185185
continue;
186186
}
187-
if (util::syscall(__NR_fsconfig, (uintptr_t)fs_fd,
188-
(uintptr_t)FSCONFIG_SET_FLAG, (uintptr_t)opt.c_str(),
189-
(uintptr_t)nullptr, (uintptr_t)0) < 0) {
190-
PLOG_W("fsconfig(flag='%s')", opt.c_str());
191-
return -1;
187+
auto eq = opt.find('=');
188+
if (eq != std::string::npos) {
189+
std::string key = opt.substr(0, eq);
190+
std::string val = opt.substr(eq + 1);
191+
if (util::syscall(__NR_fsconfig, (uintptr_t)fs_fd,
192+
(uintptr_t)FSCONFIG_SET_STRING, (uintptr_t)key.c_str(),
193+
(uintptr_t)val.c_str(), (uintptr_t)0) < 0) {
194+
PLOG_W("fsconfig(key='%s', value='%s')", key.c_str(),
195+
val.c_str());
196+
return -1;
197+
}
198+
} else {
199+
if (util::syscall(__NR_fsconfig, (uintptr_t)fs_fd,
200+
(uintptr_t)FSCONFIG_SET_FLAG, (uintptr_t)opt.c_str(),
201+
(uintptr_t)nullptr, (uintptr_t)0) < 0) {
202+
PLOG_W("fsconfig(flag='%s')", opt.c_str());
203+
return -1;
204+
}
192205
}
193206
}
194207
}

0 commit comments

Comments
 (0)