The commit is pushed to "branch-rh9-5.14.0-427.106.1.vz9.90.x-ovz" and will
appear at [email protected]:openvz/vzkernel.git
after rh9-5.14.0-427.106.1.vz9.90.1
------>
commit bea4d0fb4e3134eb2207586bfd26d1d8cd5fde65
Author: Vasileios Almpanis <[email protected]>
Date: Thu Jan 29 11:15:06 2026 +0000
Revert "fs: Introduce vfs_truncate2() with file argument"
This reverts commit b210a3d6813c1155a3212979877d260fccb982de.
https://virtuozzo.atlassian.net/browse/VSTOR-123292
Signed-off-by: Vasileios Almpanis <[email protected]>
Feature: vstorage: vfs_truncate2() with file argument
======
Patchset description:
dm-ploop: truncate helpers cleanup and read-only table fix
- Add a new do_ftruncate() helper that operates directly on a struct
file, allowing in-kernel callers to truncate files without going
through file descriptor based interfaces.
- Export do_ftruncate() so it can be used by other kernel subsystems.
- Revert the recently introduced vfs_truncate2() helper, which becomes
redundant after exporting do_ftruncate() and adds unnecessary API
surface.
- Fix dm-ploop target constructor logic to avoid preallocating
clusters when the table is created in read-only mode. Userspace
may still pass the optional fallo_new_clu argument, but
preallocation must be skipped for read-only ploop devices.
---
drivers/md/dm-ploop-map.c | 2 +-
drivers/md/dm-qcow2-map.c | 2 +-
fs/open.c | 6 +++---
include/linux/fs.h | 6 +-----
kernel/trace/bpf_trace.c | 2 +-
5 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index ecb2eadbd0ae3..2739cc3f09028 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -1134,7 +1134,7 @@ static int ploop_truncate_prealloc_safe(struct ploop
*ploop,
return 0;
if (!ploop->falloc_new_clu)
- ret = vfs_truncate2(&file->f_path, new_len, file);
+ ret = do_ftruncate(file, new_len, 0);
else
ret = vfs_fallocate(file, 0, old_len, new_len - old_len);
if (ret) {
diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c
index 80552e2ab7342..5197f64b12784 100644
--- a/drivers/md/dm-qcow2-map.c
+++ b/drivers/md/dm-qcow2-map.c
@@ -2145,7 +2145,7 @@ static loff_t find_unused_cluster(struct qcow2 *qcow2,
struct qio **qio,
int qcow2_truncate_safe(struct file *file, loff_t new_len)
{
- return vfs_truncate2(&file->f_path, new_len, file);
+ return do_ftruncate(file, new_len, 0);
}
static int truncate_prealloc_safe(struct qcow2 *qcow2, loff_t len, const char
*func)
diff --git a/fs/open.c b/fs/open.c
index b166d00e23663..93d91d7ed25d1 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -67,7 +67,7 @@ int do_truncate(struct user_namespace *mnt_userns, struct
dentry *dentry,
return ret;
}
-long vfs_truncate2(const struct path *path, loff_t length, struct file *file)
+long vfs_truncate(const struct path *path, loff_t length)
{
struct user_namespace *mnt_userns;
struct inode *inode;
@@ -108,7 +108,7 @@ long vfs_truncate2(const struct path *path, loff_t length,
struct file *file)
error = security_path_truncate(path);
if (!error)
- error = do_truncate(mnt_userns, path->dentry, length, 0, file);
+ error = do_truncate(mnt_userns, path->dentry, length, 0, NULL);
put_write_and_out:
put_write_access(inode);
@@ -117,7 +117,7 @@ long vfs_truncate2(const struct path *path, loff_t length,
struct file *file)
out:
return error;
}
-EXPORT_SYMBOL_GPL(vfs_truncate2);
+EXPORT_SYMBOL_GPL(vfs_truncate);
long do_sys_truncate(const char __user *pathname, loff_t length)
{
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 9d28258331b4e..8af72cf02b4ca 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2762,11 +2762,7 @@ static inline bool is_idmapped_mnt(const struct vfsmount
*mnt)
return mnt_user_ns(mnt) != mnt->mnt_sb->s_user_ns;
}
-extern long vfs_truncate2(const struct path *, loff_t, struct file *);
-static inline long vfs_truncate(const struct path *path, loff_t off)
-{
- return vfs_truncate2(path, off, NULL);
-}
+extern long vfs_truncate(const struct path *, loff_t);
int do_truncate(struct user_namespace *, struct dentry *, loff_t start,
unsigned int time_attrs, struct file *filp);
extern long do_ftruncate(struct file *file, loff_t length, int small);
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index 9a312fb71685f..a4969f775c39c 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -938,7 +938,7 @@ BTF_ID(func, security_file_open)
#ifdef CONFIG_SECURITY_PATH
BTF_ID(func, security_path_truncate)
#endif
-BTF_ID(func, vfs_truncate2)
+BTF_ID(func, vfs_truncate)
BTF_ID(func, do_ftruncate)
BTF_ID(func, vfs_fallocate)
BTF_ID(func, dentry_open)
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel