export the do_ftruncate function so kernel code
can use it directly with file handles without having
to pass the file descriptor number.

https://virtuozzo.atlassian.net/browse/VSTOR-123292
Signed-off-by: Vasileios Almpanis <[email protected]>

Feature: fix ms/fs
---
 fs/open.c                | 1 +
 include/linux/fs.h       | 1 +
 kernel/trace/bpf_trace.c | 1 +
 3 files changed, 3 insertions(+)

diff --git a/fs/open.c b/fs/open.c
index 3c25351be064..8ff26fc32e78 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -184,6 +184,7 @@ long do_ftruncate(struct file *file, loff_t length, int 
small)
 
        return error;
 }
+EXPORT_SYMBOL_GPL(do_ftruncate);
 
 long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
 {
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 4c833f9496c1..b7daad9a1e19 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2731,6 +2731,7 @@ static inline long vfs_truncate(const struct path *path, 
loff_t off)
 }
 int do_truncate(struct mnt_idmap *, struct dentry *, loff_t start,
                unsigned int time_attrs, struct file *filp);
+extern long do_ftruncate(struct file *file, loff_t length, int small);
 extern int vfs_fallocate(struct file *file, int mode, loff_t offset,
                        loff_t len);
 extern long do_sys_open(int dfd, const char __user *filename, int flags,
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index 2503aa1e39c2..54ee99a60cbc 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -920,6 +920,7 @@ BTF_ID(func, security_file_open)
 BTF_ID(func, security_path_truncate)
 #endif
 BTF_ID(func, vfs_truncate2)
+BTF_ID(func, do_ftruncate)
 BTF_ID(func, vfs_fallocate)
 BTF_ID(func, dentry_open)
 BTF_ID(func, vfs_getattr)
-- 
2.43.0

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to