The commit is pushed to "branch-rh10-6.12.0-55.52.1.4.x.vz10-ovz" and will 
appear at [email protected]:openvz/vzkernel.git
after rh10-6.12.0-55.52.1.4.1.vz10
------>
commit eeb35b31b5e6e8edb76704882a1bb8227ca10fcc
Author: Vasileios Almpanis <[email protected]>
Date:   Thu Jan 29 11:09: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
    
      - 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 fad333905560b..6fe62441471a1 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 4baf26eb95742..8ec3b6b7d45af 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 8ff26fc32e789..947672bd2bc77 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -67,7 +67,7 @@ int do_truncate(struct mnt_idmap *idmap, 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 mnt_idmap *idmap;
        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(idmap, path->dentry, length, 0, file);
+               error = do_truncate(idmap, 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 b7daad9a1e194..a89d5ecfb44a7 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2724,11 +2724,7 @@ static inline bool is_idmapped_mnt(const struct vfsmount 
*mnt)
        return mnt_idmap(mnt) != &nop_mnt_idmap;
 }
 
-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 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);
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index 54ee99a60cbc8..ed45c3677a462 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -919,7 +919,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

Reply via email to