public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] corrupted reiserfs may cause kernel to panic on lookup() sometimes.
@ 2002-01-03  7:18 Oleg Drokin
  2002-01-11 17:46 ` [reiserfs-dev] " Chris Mason
  0 siblings, 1 reply; 3+ messages in thread
From: Oleg Drokin @ 2002-01-03  7:18 UTC (permalink / raw)
  To: marcelo, linux-kernel, reiserfs-dev

[-- Attachment #1: Type: text/plain, Size: 164 bytes --]

Hello!

    Certain disk corruptions and i/o errors may cause lookup() to panic, which is wrong.
    This patch fixes the problem.
    Please apply.

Bye,
    Oleg

[-- Attachment #2: corrupted_fs_panic_on_lookup_fix.diff --]
[-- Type: text/plain, Size: 643 bytes --]

--- linux/fs/reiserfs/namei.c.orig	Tue Dec 25 16:27:27 2001
+++ linux/fs/reiserfs/namei.c	Tue Dec 25 16:29:13 2001
@@ -309,9 +309,10 @@
 
     while (1) {
 	retval = search_by_entry_key (dir->i_sb, &key_to_search, path_to_entry, de);
-	if (retval == IO_ERROR)
-	    // FIXME: still has to be dealt with
-	    reiserfs_panic (dir->i_sb, "zam-7001: io error in " __FUNCTION__ "\n");
+	if (retval == IO_ERROR) {
+	    reiserfs_warning ("zam-7001: io error in " __FUNCTION__ "\n");
+	    return IO_ERROR;
+	}
 
 	/* compare names for all entries having given hash value */
 	retval = linear_search_in_dir_item (&key_to_search, de, name, namelen);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [reiserfs-dev] [PATCH] corrupted reiserfs may cause kernel to panic on lookup() sometimes.
  2002-01-03  7:18 [PATCH] corrupted reiserfs may cause kernel to panic on lookup() sometimes Oleg Drokin
@ 2002-01-11 17:46 ` Chris Mason
  2002-01-14  5:56   ` Oleg Drokin
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Mason @ 2002-01-11 17:46 UTC (permalink / raw)
  To: Oleg Drokin, marcelo, linux-kernel, reiserfs-dev



On Thursday, January 03, 2002 10:18:30 AM +0300 Oleg Drokin
<green@namesys.com> wrote:

> Hello!
> 
>     Certain disk corruptions and i/o errors may cause lookup() to panic,
> which is wrong.     This patch fixes the problem.
>     Please apply.

Hmmm, none of the callers of reiserfs_find_entry have been changed to check
for IO_ERROR.  We should at least change reiserfs_add_entry to check for
IO_ERROR, so it doesn't try to create a name after getting io error during
the lookup.

-chris

--- linux/fs/reiserfs/namei.c.orig	Tue Dec 25 16:27:27 2001
+++ linux/fs/reiserfs/namei.c	Tue Dec 25 16:29:13 2001
@@ -309,9 +309,10 @@
 
     while (1) {
 	retval = search_by_entry_key (dir->i_sb, &key_to_search, path_to_entry, de);
-	if (retval == IO_ERROR)
-	    // FIXME: still has to be dealt with
-	    reiserfs_panic (dir->i_sb, "zam-7001: io error in " __FUNCTION__ "\n");
+	if (retval == IO_ERROR) {
+	    reiserfs_warning ("zam-7001: io error in " __FUNCTION__ "\n");
+	    return IO_ERROR;
+	}
 
 	/* compare names for all entries having given hash value */
 	retval = linear_search_in_dir_item (&key_to_search, de, name, namelen);


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [reiserfs-dev] [PATCH] corrupted reiserfs may cause kernel to panic on lookup() sometimes.
  2002-01-11 17:46 ` [reiserfs-dev] " Chris Mason
@ 2002-01-14  5:56   ` Oleg Drokin
  0 siblings, 0 replies; 3+ messages in thread
From: Oleg Drokin @ 2002-01-14  5:56 UTC (permalink / raw)
  To: Chris Mason; +Cc: linux-kernel, reiserfs-dev

Hello!

On Fri, Jan 11, 2002 at 12:46:26PM -0500, Chris Mason wrote:

> >     Certain disk corruptions and i/o errors may cause lookup() to panic,
> > which is wrong.     This patch fixes the problem.
> >     Please apply.
> Hmmm, none of the callers of reiserfs_find_entry have been changed to check
> for IO_ERROR.  We should at least change reiserfs_add_entry to check for
> IO_ERROR, so it doesn't try to create a name after getting io error during
> the lookup.
Well, in fact reiserfs_add_entry won't do that anyway, consider this code:
    retval = reiserfs_find_entry (dir, name, namelen, &path, &de);
    if( retval != NAME_NOT_FOUND ) {
        if (buffer != small_buf)
            reiserfs_kfree (buffer, buflen, dir->i_sb);
        pathrelse (&path);

        if (retval != NAME_FOUND) {
            reiserfs_warning ("zam-7002:" __FUNCTION__ ": \"reiserfs_find_entry\" has returned"
                              " unexpected value (%d)\n", retval);
       }

        return -EEXIST;
    }

Though I see other places where code is not that smart. I'll come up with additional patch later today.
Thanks for noticing.

Bye,
    Oleg

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-01-14  5:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-01-03  7:18 [PATCH] corrupted reiserfs may cause kernel to panic on lookup() sometimes Oleg Drokin
2002-01-11 17:46 ` [reiserfs-dev] " Chris Mason
2002-01-14  5:56   ` Oleg Drokin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox