[Devel] [PATCH vz9] ve/fs: don't try to sync non-existing bdev

Nikita Yushchenko nikita.yushchenko at virtuozzo.com
Fri Dec 10 12:20:02 MSK 2021


In the implementation of per-CT sync, in non-toor VE bdev sync was
moved to sync_fs_one_sb(). But a check for non-NULL sb->s_bdev was
missed there, causing an attempt to fix bdev even whern there is none,
and a null pointer dereference.

https://jira.sw.ru/browse/PSBM-136885
Fixes: adaa7cfac559 ("ve/fs: per-CT sync behavior management")
Signed-off-by: Nikita Yushchenko <nikita.yushchenko at virtuozzo.com>
---
 fs/sync.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/sync.c b/fs/sync.c
index ffe244370948..946a121361f6 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -112,7 +112,7 @@ static void sync_fs_one_sb(struct super_block *sb, void *arg)
 			sb->s_op->sync_fs(sb, sarg->wait);
 
 		/* See comment in ksys_sync() bellow */
-		if (sarg->ve) {
+		if (sarg->ve && sb->s_bdev) {
 			fdatawrite_one_bdev(sb->s_bdev, NULL);
 			fdatawait_one_bdev(sb->s_bdev, NULL);
 		}
-- 
2.30.2



More information about the Devel mailing list