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
---
 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 fad333905560..6fe62441471a 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 4baf26eb9574..8ec3b6b7d45a 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 8ff26fc32e78..947672bd2bc7 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 b7daad9a1e19..a89d5ecfb44a 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 54ee99a60cbc..ed45c3677a46 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)
-- 
2.43.0

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

Reply via email to