All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: Alexey Kuznetsov <kuznet@virtuozzo.com>
To: devel@openvz.org, khorenko@virtuozzo.com, kui.liu@virtuozzo.com,
	azaitsev@virtuozzo.com
Subject: [Devel] [PATCH hci-8.1 v2 3/5] fs/ext4: assert presence of journal for swapext
Date: Wed, 18 Nov 2026 00:59:47 +0800	[thread overview]
Message-ID: <avyIA+e7tQ6w8MUw@mops2> (raw)

On fs w/o journal swapext would crash f.e. dereferencing
fake journal handle. Actually, the whole swapext
does not make sense without journal.

Fixes: 1a3d440e7fbc ("fs/ext4: swapext ioctl")
Affects: #VSTOR-155599
https://virtuozzo.atlassian.net/browse/VSTOR-155599

Signed-off-by: Alexey Kuznetsov <kuznet@virtuozzo.com>

Feature: ext4: swapext ioctl: swap range of blocks between two files
---
 fs/ext4/move_extent.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
index dfbdb571105f..cd07efaa1f30 100644
--- a/fs/ext4/move_extent.c
+++ b/fs/ext4/move_extent.c
@@ -868,6 +868,10 @@ ext4_ioc_swap_extents(struct file *o_filp, struct file *d_filp, __u64 orig_blk,
 	if (!S_ISREG(orig_inode->i_mode) || !S_ISREG(donor_inode->i_mode))
 		return -EINVAL;
 
+	/* Do not even try to do atomic swap w/o journal */
+	if (!EXT4_SB(orig_inode->i_sb)->s_journal)
+		return -EOPNOTSUPP;
+
 	/* TODO: it's not obvious how to swap blocks for inodes with full
 	 * journaling enabled
 	 */
-- 
2.47.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

                 reply	other threads:[~2026-11-17 17:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=avyIA+e7tQ6w8MUw@mops2 \
    --to=kuznet@virtuozzo.com \
    --cc=azaitsev@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=khorenko@virtuozzo.com \
    --cc=kui.liu@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.