Re: ext2fs bug : files are disapeared, unable to delete, two files' contents are switched etc.

From: Andreas Dilger (adilger@home.com)
Date: Sun Mar 26 2000 - 22:41:16 EST


Ted Ts'o patch has:
> /*
> * N.B. Several error exits in ext2_new_inode don't set err.
> */
> inode = ext2_new_inode (dir, mode, &err);
> if (!inode)
> - return err;
> + return -EIO;

If we are changing namei.c, can we also remove the above (untrue)
comment from ext2_create, and leave the code returning the real err?
Otherwise, we are discarding other (valid) error returns (-EDQUOT,
-ENOSPC, -ENOMEM, -EPERM) for no real reason.

I've looked through ext2_new_inode(), and there are NO returns where
ext2_new_inode() doesn't set err on an error condition. Maybe this
was true at one time, but it is no longer so. The first two returns
set -EPERM and -ENOMEM, and after that err is set to -ENOSPC unless
otherwise specified (for all of the returns where it is not explicitly
set). Arguably, for the returns where there are errors in the bitmaps
or GDT we could return something other than -ENOSPC, but that is
something to fix in ext2_new_inode() and not in the calling function.

The calls to ext2_new_inode() in ext2_mknod(), ext2_mkdir(), and
ext2_symlink() don't have this oddness. In fact, you could get rid of
the initialization of err=-EIO in those functions as well, as err is
always set to SOMETHING in ext2_new_inode...

Cheers, Andreas

-- 
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert

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



This archive was generated by hypermail 2b29 : Fri Mar 31 2000 - 21:00:18 EST