lkml.org 
[lkml]   [2000]   [Oct]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 2.4.0-test9: minixfs causing oopsen when out of inodes


On Sun, 8 Oct 2000, Russell King wrote:
>
> The only time that minix_new_inode sets *error is if it succeeds! The
> same applies to minix_mknod, minix_mkdir, and minix_symlink. With this
> fixed, the above oops no longer happens. Here is a patch to fix this.
> This makes minix follow the same "method" as ext2fs towards returning
> errors from *_new_inode:

Patch looks fine, and applied.

HOWEVER, it does show once again, that the way these errors are passed
around is just fundamentally broken. It would probably be better to follow
the _real_ rules for error handling, which are:

ALWAYS _RETURN_ THE ERROR.

Having return values passed by an argument pointer is broken. ALWAYS.

This, btw, is why Linux returns error numbers as -Exxx instead of using
"-1" and "errno" - I dislike the latter enormously.

This is also why the VFS layer tends to use ERR_PTR/PTR_ERR/IS_ERR: it
makes it very easy to pass back error information, and it makes it very
hard to do it wrong. I suspect both minix and ext2 would be better off
using that convention instead.

It's not worth changing at this point, but for future reference it would
probably be much preferable to return the error code instead of the
horrible "error value through pointer access" method, which is usually
rather inefficient too.

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:39    [W:0.060 / U:2.416 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site