From: Amir Goldor <amir73il@users.sourceforge.net>
To: Andreas Dilger <adilger@sun.com>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-ext4@vger.kernel.org
Subject: Re: Errors reported by Coverity in ext3
Date: Sun, 12 Apr 2009 14:58:05 +0300 [thread overview]
Message-ID: <18730dc50904120458m1649aaf7tab395436d159105a@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 267 bytes --]
Hi Andreas,
in reply to your message from 2006
(http://marc.info/?l=linux-ext4&m=116310729115980&w=2)
I have prepared a small patch to check jbd errors on 4 occurrences in namei.c
could you please review my patch
please CC me personally in your reply
Thanks,
Amir.
[-- Attachment #2: ext3-namei-check-jbd-errors-2.6.28.patch --]
[-- Type: application/octet-stream, Size: 2151 bytes --]
diff -aur linux-2.6.28.orig/fs/ext3/namei.c linux-2.6.28/fs/ext3/namei.c
--- linux-2.6.28.orig/fs/ext3/namei.c 2009-04-12 11:58:41.000000000 +0300
+++ linux-2.6.28/fs/ext3/namei.c 2009-04-12 14:15:55.000000000 +0300
@@ -1616,7 +1616,7 @@
struct buffer_head * bh)
{
struct ext3_dir_entry_2 * de, * pde;
- int i;
+ int i, err;
i = 0;
pde = NULL;
@@ -1626,7 +1626,9 @@
return -EIO;
if (de == de_del) {
BUFFER_TRACE(bh, "get_write_access");
- ext3_journal_get_write_access(handle, bh);
+ err = ext3_journal_get_write_access(handle, bh);
+ if (err)
+ return err;
if (pde)
pde->rec_len = ext3_rec_len_to_disk(
ext3_rec_len_from_disk(pde->rec_len) +
@@ -1770,7 +1772,13 @@
goto out_stop;
}
BUFFER_TRACE(dir_block, "get_write_access");
- ext3_journal_get_write_access(handle, dir_block);
+ err = ext3_journal_get_write_access(handle, dir_block);
+ if (err) {
+ drop_nlink(inode); /* is this nlink == 0? */
+ ext3_mark_inode_dirty(handle, inode);
+ iput (inode);
+ goto out_stop;
+ }
de = (struct ext3_dir_entry_2 *) dir_block->b_data;
de->inode = cpu_to_le32(inode->i_ino);
de->name_len = 1;
@@ -2302,7 +2310,9 @@
goto end_rename;
} else {
BUFFER_TRACE(new_bh, "get write access");
- ext3_journal_get_write_access(handle, new_bh);
+ retval = ext3_journal_get_write_access(handle, new_bh);
+ if (retval)
+ goto end_rename;
new_de->inode = cpu_to_le32(old_inode->i_ino);
if (EXT3_HAS_INCOMPAT_FEATURE(new_dir->i_sb,
EXT3_FEATURE_INCOMPAT_FILETYPE))
@@ -2360,7 +2370,14 @@
ext3_update_dx_flag(old_dir);
if (dir_bh) {
BUFFER_TRACE(dir_bh, "get_write_access");
- ext3_journal_get_write_access(handle, dir_bh);
+ retval = ext3_journal_get_write_access(handle, dir_bh);
+ if (retval) {
+ ext3_warning(old_dir->i_sb, "ext3_rename",
+ "Updating new directory (%lu) parent link, %d, error=%d",
+ new_dir->i_ino, new_dir->i_nlink, retval);
+ }
+ }
+ if (dir_bh && !retval) {
PARENT_INO(dir_bh->b_data) = cpu_to_le32(new_dir->i_ino);
BUFFER_TRACE(dir_bh, "call ext3_journal_dirty_metadata");
ext3_journal_dirty_metadata(handle, dir_bh);
next reply other threads:[~2009-04-12 11:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-12 11:58 Amir Goldor [this message]
2009-04-13 22:02 ` Errors reported by Coverity in ext3 Andreas Dilger
2009-04-16 9:30 ` Amir Goldor
2009-04-20 22:14 ` Andreas Dilger
2009-04-21 9:01 ` Amir Goldor
2009-04-21 11:59 ` [PATCH] " Andreas Dilger
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=18730dc50904120458m1649aaf7tab395436d159105a@mail.gmail.com \
--to=amir73il@users.sourceforge.net \
--cc=adilger@sun.com \
--cc=akpm@linux-foundation.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).