if (r < 0)
return r;
- r = home_unshare_and_mount(setup->dm_node, fstype, user_record_luks_discard(h), user_record_mount_flags(h));
+ r = home_unshare_and_mount(setup->dm_node, fstype, user_record_luks_discard(h), user_record_mount_flags(h), h->luks_extra_mount_options);
if (r < 0)
return r;
log_info("Formatting file system completed.");
- r = home_unshare_and_mount(setup->dm_node, fstype, user_record_luks_discard(h), user_record_mount_flags(h));
+ r = home_unshare_and_mount(setup->dm_node, fstype, user_record_luks_discard(h), user_record_mount_flags(h), h->luks_extra_mount_options);
if (r < 0)
return r;
return CAN_RESIZE_ONLINE;
}
-static int ext4_offline_resize_fs(HomeSetup *setup, uint64_t new_size, bool discard, unsigned long flags) {
+static int ext4_offline_resize_fs(
+ HomeSetup *setup,
+ uint64_t new_size,
+ bool discard,
+ unsigned long flags,
+ const char *extra_mount_options) {
+
_cleanup_free_ char *size_str = NULL;
bool re_open = false, re_mount = false;
pid_t resize_pid, fsck_pid;
/* Re-establish mounts and reopen the directory */
if (re_mount) {
- r = home_mount_node(setup->dm_node, "ext4", discard, flags);
+ r = home_mount_node(setup->dm_node, "ext4", discard, flags, extra_mount_options);
if (r < 0)
return r;
if (r < 0)
return log_error_errno(r, "Failed to resize file system: %m");
} else {
- r = ext4_offline_resize_fs(setup, new_fs_size, user_record_luks_discard(h), user_record_mount_flags(h));
+ r = ext4_offline_resize_fs(setup, new_fs_size, user_record_luks_discard(h), user_record_mount_flags(h), h->luks_extra_mount_options);
if (r < 0)
return r;
}
return NULL;
}
-int home_mount_node(const char *node, const char *fstype, bool discard, unsigned long flags) {
+int home_mount_node(
+ const char *node,
+ const char *fstype,
+ bool discard,
+ unsigned long flags,
+ const char *extra_mount_options) {
+
_cleanup_free_ char *joined = NULL;
- const char *options, *discard_option;
+ const char *default_options;
int r;
assert(node);
assert(fstype);
- options = mount_options_for_fstype(fstype);
+ default_options = mount_options_for_fstype(fstype);
+ if (default_options) {
+ if (!strextend_with_separator(&joined, ",", default_options))
+ return log_oom();
+ }
- discard_option = discard ? "discard" : "nodiscard";
+ if (!strextend_with_separator(&joined, ",", discard ? "discard" : "nodiscard"))
+ return log_oom();
- if (options) {
- joined = strjoin(options, ",", discard_option);
- if (!joined)
+ if (extra_mount_options) {
+ if (!strextend_with_separator(&joined, ",", extra_mount_options))
return log_oom();
+ }
- options = joined;
- } else
- options = discard_option;
-
- r = mount_nofollow_verbose(LOG_ERR, node, HOME_RUNTIME_WORK_DIR, fstype, flags|MS_RELATIME, strempty(options));
+ r = mount_nofollow_verbose(LOG_ERR, node, HOME_RUNTIME_WORK_DIR, fstype, flags|MS_RELATIME, joined);
if (r < 0)
return r;
return 0;
}
-int home_unshare_and_mount(const char *node, const char *fstype, bool discard, unsigned long flags) {
+int home_unshare_and_mount(
+ const char *node,
+ const char *fstype,
+ bool discard,
+ unsigned long flags,
+ const char *extra_mount_options) {
+
int r;
assert(node);
if (r < 0)
return r;
- r = home_mount_node(node, fstype, discard, flags);
+ r = home_mount_node(node, fstype, discard, flags, extra_mount_options);
if (r < 0)
return r;
#include <stdbool.h>
-int home_mount_node(const char *node, const char *fstype, bool discard, unsigned long flags);
+int home_mount_node(const char *node, const char *fstype, bool discard, unsigned long flags, const char *extra_mount_options);
int home_unshare_and_mkdir(void);
-int home_unshare_and_mount(const char *node, const char *fstype, bool discard, unsigned long flags);
+int home_unshare_and_mount(const char *node, const char *fstype, bool discard, unsigned long flags, const char *extra_mount_options);
int home_move_mount(const char *user_name_and_realm, const char *target);
int home_shift_uid(int dir_fd, const char *target, uid_t stored_uid, uid_t exposed_uid, int *ret_mount_fd);
if (hr->file_system_type)
printf(" File System: %s\n", user_record_file_system_type(hr));
+ if (hr->luks_extra_mount_options)
+ printf("LUKS MntOpts: %s\n", hr->luks_extra_mount_options);
+
if (hr->luks_cipher)
printf(" LUKS Cipher: %s\n", hr->luks_cipher);
if (hr->luks_cipher_mode)
free(h->luks_cipher_mode);
free(h->luks_pbkdf_hash_algorithm);
free(h->luks_pbkdf_type);
+ free(h->luks_extra_mount_options);
free(h->state);
free(h->service);
{ "luksPbkdfTimeCostUSec", JSON_VARIANT_UNSIGNED, json_dispatch_uint64, offsetof(UserRecord, luks_pbkdf_time_cost_usec), 0 },
{ "luksPbkdfMemoryCost", JSON_VARIANT_UNSIGNED, json_dispatch_uint64, offsetof(UserRecord, luks_pbkdf_memory_cost), 0 },
{ "luksPbkdfParallelThreads", JSON_VARIANT_UNSIGNED, json_dispatch_uint64, offsetof(UserRecord, luks_pbkdf_parallel_threads), 0 },
+ { "luksExtraMountOptions", JSON_VARIANT_STRING, json_dispatch_string, offsetof(UserRecord, luks_extra_mount_options), 0 },
{ "dropCaches", JSON_VARIANT_BOOLEAN, json_dispatch_tristate, offsetof(UserRecord, drop_caches), 0 },
{ "rateLimitIntervalUSec", JSON_VARIANT_UNSIGNED, json_dispatch_uint64, offsetof(UserRecord, ratelimit_interval_usec), 0 },
{ "rateLimitBurst", JSON_VARIANT_UNSIGNED, json_dispatch_uint64, offsetof(UserRecord, ratelimit_burst), 0 },
{ "luksPbkdfTimeCostUSec", JSON_VARIANT_UNSIGNED, json_dispatch_uint64, offsetof(UserRecord, luks_pbkdf_time_cost_usec), 0 },
{ "luksPbkdfMemoryCost", JSON_VARIANT_UNSIGNED, json_dispatch_uint64, offsetof(UserRecord, luks_pbkdf_memory_cost), 0 },
{ "luksPbkdfParallelThreads", JSON_VARIANT_UNSIGNED, json_dispatch_uint64, offsetof(UserRecord, luks_pbkdf_parallel_threads), 0 },
+ { "luksExtraMountOptions", JSON_VARIANT_STRING, json_dispatch_string, offsetof(UserRecord, luks_extra_mount_options), 0 },
{ "dropCaches", JSON_VARIANT_BOOLEAN, json_dispatch_tristate, offsetof(UserRecord, drop_caches), 0 },
{ "service", JSON_VARIANT_STRING, json_dispatch_string, offsetof(UserRecord, service), JSON_SAFE },
{ "rateLimitIntervalUSec", JSON_VARIANT_UNSIGNED, json_dispatch_uint64, offsetof(UserRecord, ratelimit_interval_usec), 0 },
uint64_t luks_pbkdf_time_cost_usec;
uint64_t luks_pbkdf_memory_cost;
uint64_t luks_pbkdf_parallel_threads;
+ char *luks_extra_mount_options;
uint64_t disk_usage;
uint64_t disk_free;