All of lore.kernel.org
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Zheng Liu <gnehzuil.liu@gmail.com>,
	linux-ext4 <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH] ext4: fix same-dir rename when inline data directory overflows
Date: Mon, 25 Aug 2014 22:49:20 -0400	[thread overview]
Message-ID: <20140826024920.GH11317@thunk.org> (raw)
In-Reply-To: <20140825194031.GE22645@birch.djwong.org>

On Mon, Aug 25, 2014 at 12:40:31PM -0700, Darrick J. Wong wrote:
> When performing a same-directory rename, it's possible that adding or
> setting the new directory entry will cause the directory to overflow
> the inline data area, which causes the directory to be converted to an
> extent-based directory.  Under this circumstance it is necessary to
> re-read the directory when deleting the old dirent because the "old
> directory" context still points to i_block in the inode table, which
> is now an extent tree root!  The delete fails with an FS error, and
> the subsequent fsck complains about incorrect link counts and
> hardlinked directories.
> 
> Test case (originally found with flat_dir_test in the metadata_csum
> test program):
> 
> # mkfs.ext4 -O inline_data /dev/sda
> # mount /dev/sda /mnt
> # mkdir /mnt/x
> # touch /mnt/x/changelog.gz /mnt/x/copyright /mnt/x/README.Debian
> # sync
> # for i in /mnt/x/*; do mv $i $i.longer; done
> # ls -la /mnt/x/
> total 0
> -rw-r--r-- 1 root root 0 Aug 25 12:03 changelog.gz.longer
> -rw-r--r-- 1 root root 0 Aug 25 12:03 copyright
> -rw-r--r-- 1 root root 0 Aug 25 12:03 copyright.longer
> -rw-r--r-- 1 root root 0 Aug 25 12:03 README.Debian.longer
> 
> (Hey!  Why are there four files now??)
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Thanks, applied.

						- Ted

      reply	other threads:[~2014-08-26  2:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-25 19:40 [PATCH] ext4: fix same-dir rename when inline data directory overflows Darrick J. Wong
2014-08-26  2:49 ` Theodore Ts'o [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=20140826024920.GH11317@thunk.org \
    --to=tytso@mit.edu \
    --cc=darrick.wong@oracle.com \
    --cc=gnehzuil.liu@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    /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.