Linux EXT4 FS development
 help / color / mirror / Atom feed
From: "Theodore Tso" <tytso@mit.edu>
To: Guikun Yang <yangguikun19@qq.com>
Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [Bug report] ext4: EXT4_IOC_MOVE_EXT with len == 0 clamps the length to the whole origin file and overwrites the donor
Date: Tue, 1 Dec 2026 00:18:50 -0500	[thread overview]
Message-ID: <aw5Xc_DYmmoUyLNM@mit.edu> (raw)
In-Reply-To: <tencent_222E4C65A3387C84A3C85205BE2B46649D09@qq.com>

On Tue, Dec 01, 2026 at 12:40:00AM -0500, Guikun Yang wrote:
> Hi Ted, Jan,
> 
> A regular (non-corrupted) ext4 filesystem lets EXT4_IOC_MOVE_EXT with
> me.len == 0 destroy the donor file's data.  The ioctl returns 0 with
> moved_len == 1; after a remount the donor file is left empty and
> e2fsck reports a clean filesystem throughout.

Why should we care about the donor file's data?  The normal path is
that e4defrag allocates blocks associated with the new donor inode,
and if the donor inode is more contiguous than the target inode, we
then copy the contents of the target inode to the blocks in the donor
inode, and then the those blocks are assigned to the target inode ---
and then e4defrag will delete the the donor inode.

IF the file system gets corrupted, or the data in the target inode is
getting corrupted, that would be really serious.  Your bug report is
focused onthe donor inode, and not what is happening with the target
inode.  So there may be a problem here, but it appears that it's not
terribly serious.  What am I missing?

						- Ted

      reply	other threads:[~2026-12-01  5:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 16:40 [Bug report] ext4: EXT4_IOC_MOVE_EXT with len == 0 clamps the length to the whole origin file and overwrites the donor Guikun Yang
2026-12-01  5:18 ` Theodore Tso [this message]

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=aw5Xc_DYmmoUyLNM@mit.edu \
    --to=tytso@mit.edu \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yangguikun19@qq.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox