From: Andrew Morton <akpm@digeo.com>
To: chrisl@vmware.com
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
Ext2 devel <ext2-devel@lists.sourceforge.net>,
Linux Kernel List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Fix bug in ext3 htree rename: doesn't delete old name, leaves ino with bad nlink
Date: Wed, 06 Nov 2002 00:44:21 -0800 [thread overview]
Message-ID: <3DC8D665.40CA099A@digeo.com> (raw)
In-Reply-To: 20021106082500.GA3680@vmware.com
chrisl@vmware.com wrote:
>
> This should fix the ext3 htree rename problem. Please try it again.
>
The 2.5 version....
--- 25/fs/ext3/namei.c~ext3-rename-fix Wed Nov 6 00:36:43 2002
+++ 25-akpm/fs/ext3/namei.c Wed Nov 6 00:41:20 2002
@@ -2160,7 +2160,7 @@ static int ext3_rename (struct inode * o
lock_kernel();
handle = ext3_journal_start(old_dir, 2 * EXT3_DATA_TRANS_BLOCKS +
- EXT3_INDEX_EXTRA_TRANS_BLOCKS + 2);
+ EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3);
if (IS_ERR(handle)) {
unlock_kernel();
return PTR_ERR(handle);
@@ -2237,7 +2237,30 @@ static int ext3_rename (struct inode * o
/*
* ok, that's it
*/
- ext3_delete_entry(handle, old_dir, old_de, old_bh);
+ retval = ext3_delete_entry(handle, old_dir, old_de, old_bh);
+ if (retval == -ENOENT) {
+ /*
+ * old_de can be moved during ext3_add_entry.
+ */
+ struct buffer_head *old_bh2;
+ struct ext3_dir_entry_2 *old_de2;
+ old_bh2 = ext3_find_entry(old_dentry, &old_de2);
+ if (old_bh2) {
+ retval = ext3_delete_entry(handle, old_dir,
+ old_de2, old_bh2);
+ brelse(old_bh2);
+ } else {
+ ext3_warning(old_dir->i_sb, "ext3_rename",
+ "Deleting old file not found (%lu), %d",
+ old_dir->i_ino, old_dir->i_nlink);
+ }
+ }
+
+ if (retval) {
+ ext3_warning(old_dir->i_sb, "ext3_rename",
+ "Deleting old file (%lu), %d, error=%d",
+ old_dir->i_ino, old_dir->i_nlink, retval);
+ }
if (new_inode) {
new_inode->i_nlink--;
_
next prev parent reply other threads:[~2002-11-06 8:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-05 4:47 bug in ext3 htree rename: doesn't delete old name, leaves ino with bad nlink Jeremy Fitzhardinge
2002-11-05 21:24 ` [Ext2-devel] " chrisl
2002-11-06 5:02 ` Jeremy Fitzhardinge
2002-11-06 8:25 ` [PATCH] Fix " chrisl
2002-11-06 8:44 ` Andrew Morton [this message]
2002-11-06 21:40 ` Theodore Ts'o
2002-11-07 1:24 ` Christopher Li
2002-11-06 22:41 ` Theodore Ts'o
2002-11-06 22:47 ` Alexander Viro
2002-11-07 2:44 ` Theodore Ts'o
2002-11-07 1:58 ` Christopher Li
2002-11-06 23:27 ` [Ext2-devel] " Andreas Dilger
-- strict thread matches above, loose matches on Subject: below --
2002-11-07 5:40 [PATCH] Fix bug in ext3 htree rename: doesn't delete old name , " Christopher Li
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=3DC8D665.40CA099A@digeo.com \
--to=akpm@digeo.com \
--cc=chrisl@vmware.com \
--cc=ext2-devel@lists.sourceforge.net \
--cc=jeremy@goop.org \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox