[Devel] [PATCH RHEL9 COMMIT] FD: fs: per-CT sync behavior management

Konstantin Khorenko khorenko at virtuozzo.com
Thu Dec 9 17:45:51 MSK 2021


The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-4.vz9.10.34
------>
commit a44431e79b6dfe06a946bf64c80ecd002cdd3a3f
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Thu Dec 9 17:44:43 2021 +0300

    FD: fs: per-CT sync behavior management
    
    https://jira.sw.ru/browse/PSBM-44684
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 .../fs-per-CT_sync_behavior_management.rst         | 86 ++++++++++++++++++++++
 1 file changed, 86 insertions(+)

diff --git a/Documentation/Virtuozzo/FeatureDescriptions/fs-per-CT_sync_behavior_management.rst b/Documentation/Virtuozzo/FeatureDescriptions/fs-per-CT_sync_behavior_management.rst
new file mode 100644
index 000000000000..dadd05fc0b7e
--- /dev/null
+++ b/Documentation/Virtuozzo/FeatureDescriptions/fs-per-CT_sync_behavior_management.rst
@@ -0,0 +1,86 @@
+===================================
+fs: per-CT sync behavior management
+===================================
+
+This feature makes it possible to tweak the effect of sync operations executed
+by a Container. Possible options:
+
+  * sync operations executed by a Container are noop
+  * sync operations executed by a Container work like they are executed on Host
+  * sync operations executed by a Container affect only filesystems mounted
+    inside the Container, either in the Container root or nested mount
+    namespaces
+
+The behavior of sync operations executed by a Container is configured by
+Virtuozzo specific ``fs.fsync-enable`` sysctl. The sysctl is virtualized
+(its value is per-CT) and is writeable both on Host and inside Containers.
+
+  * sync operations executed by Host do not depend on the sysctl value
+
+  * sysctl values set on Host and inside a Container affect following syscalls
+    executed in a Container:
+
+     - sync(2), fsync(2), fdatasync(2), sync_file_range(2), msync(2)
+     - open(2) and fcntl(2) (they silently clear O_SYNC flag if syncs should be
+       ignored according to sysctl values)
+
+Operation of AIO is not affected.
+
+Changing this sysctl does not affect O_SYNC flag of already opened file
+descriptors.
+
+``fs.fsync-enable`` sysctl values
+---------------------------------
+
+Host configuration
+~~~~~~~~~~~~~~~~~~
+
+``fs.fsync-enable`` sysctl Host's value defines the default sync behavior inside
+Containers on the Node. Possible values are:
+
+  * 0 (FSYNC_DISABLED):
+       sync operations inside Containers are no-ops
+  * 1 (FSYNC_ALWAYS):
+       sync operations inside Containers are fully executed, as if given on the
+       Host itself
+  * 2 (FSYNC_FILTERED), the default:
+       sync operations inside Containers cause only writing dirty data to
+       filesystems mounted anywhere inside Container, and don't affect any other
+       dirty data existing on the Host.
+
+Container configuration
+~~~~~~~~~~~~~~~~~~~~~~~
+  * 0 (FSYNC_DISABLED):
+       sync operations inside this Container are no-ops, despite of setting on
+       Host
+  * 2 (FSYNC_FILTERED), the default:
+       sync settings are taken from Host's sysctl value
+  * 1 (FSYNC_ALWAYS) and other values:
+       sync operations cause only writing dirty data to filesystems mounted
+       anywhere inside Container, and don't affect any other dirty data existing
+       on the Host/in other Containers.
+
+  +-----------+---------+------------------------------------+
+  |Host sysctl|CT sysctl|sync behavior inside CT             |
+  +===========+=========+====================================+
+  |     0     |    0    | noop                               |
+  +-----------+---------+------------------------------------+
+  |     1     |    0    | noop                               |
+  +-----------+---------+------------------------------------+
+  |     2     |    0    | noop                               |
+  +-----------+---------+------------------------------------+
+  |     0     |    1    | "filtered"                         |
+  +-----------+---------+------------------------------------+
+  |     1     |    1    | "filtered"                         |
+  +-----------+---------+------------------------------------+
+  |     2     |    1    | "filtered"                         |
+  +-----------+---------+------------------------------------+
+  |     0     |    2    | noop                               |
+  +-----------+---------+------------------------------------+
+  |     1     |    2    | syncs behave like executed on Host |
+  +-----------+---------+------------------------------------+
+  |     2     |    2    | "filtered" (default)               |
+  +-----------+---------+------------------------------------+
+
+
+https://jira.sw.ru/browse/PSBM-44684


More information about the Devel mailing list