[Devel] [PATCH RH8 2/2] ploop: Use vfs_truncate2()

Kirill Tkhai ktkhai at virtuozzo.com
Wed Jun 23 19:22:02 MSK 2021


We may lose vstorage lease on file/inode. Use vfs_truncate2(),
which cares about file argument passed to do_truncate().

Suggested-by: Alexey Kuznetsov <kuznet at virtuozzo.com>
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-ploop-map.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index dc2268670f70..55b84cf3ec2b 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -846,7 +846,7 @@ static int truncate_prealloc_safe(struct ploop_delta *delta, loff_t len, const c
 		return 0;
 	new_len = ALIGN(new_len, PREALLOC_SIZE);
 
-	ret = vfs_truncate(&file->f_path, new_len);
+	ret = vfs_truncate2(&file->f_path, new_len, file);
 	if (ret) {
 		pr_err("ploop: %s->truncate(): %d\n", func, ret);
 		return ret;




More information about the Devel mailing list