[Devel] [PATCH RHEL9 COMMIT] ve/fs: introduce is_sb_ve_accessible()
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Dec 9 11:23:21 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 47b1e1aab48848f3378495bd5e1ac04ad4ae2918
Author: Nikita Yushchenko <nikita.yushchenko at virtuozzo.com>
Date: Thu Dec 9 11:23:21 2021 +0300
ve/fs: introduce is_sb_ve_accessible()
This routine checks if any mount of the given superblock is accessible
from VE, either from root or non-root mount namespace.
To be used for per-VE sync implementation.
https://jira.sw.ru/browse/PSBM-44684
Feature: fs: per-CT sync behavior management
Signed-off-by: Nikita Yushchenko <nikita.yushchenko at virtuozzo.com>
---
fs/internal.h | 10 ++++++++++
fs/namespace.c | 17 +++++++++++++++++
2 files changed, 27 insertions(+)
diff --git a/fs/internal.h b/fs/internal.h
index 82e8eb32ff3d..257e51814d2c 100644
--- a/fs/internal.h
+++ b/fs/internal.h
@@ -96,6 +96,16 @@ int path_mount(const char *dev_name, struct path *path,
const char *type_page, unsigned long flags, void *data_page);
int path_umount(struct path *path, int flags);
+#ifdef CONFIG_VE
+extern bool is_sb_ve_accessible(struct ve_struct *ve, struct super_block *sb);
+#else
+static inline bool is_sb_ve_accessible(struct ve_struct *ve,
+ struct super_block *sb)
+{
+ return true;
+}
+#endif
+
/*
* fs_struct.c
*/
diff --git a/fs/namespace.c b/fs/namespace.c
index 558fa26bde50..8dbda795b4db 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2832,6 +2832,23 @@ static inline void ve_mount_nr_dec(struct mount *mnt)
mnt->ve_owner = NULL;
}
+bool is_sb_ve_accessible(struct ve_struct *ve, struct super_block *sb)
+{
+ struct mount *mnt;
+ bool ret = false;
+
+ lock_mount_hash();
+ list_for_each_entry(mnt, &sb->s_mounts, mnt_instance) {
+ if (mnt->ve_owner == ve) {
+ ret = true;
+ break;
+ }
+ }
+ unlock_mount_hash();
+
+ return ret;
+}
+
#else /* CONFIG_VE */
static inline int ve_mount_allowed(void) { return 1; }
More information about the Devel
mailing list