lkml.org 
[lkml]   [2005]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: 2.6.11-rc2/ext3 quota allocation bug on error path ...
> On Wed, Jan 26, 2005 at 11:24:30AM -0800, Andrew Morton wrote:
> > Andreas Gruenbacher <agruen@suse.de> wrote:
> > >
> > > > +cleanup_dquot:
> > > > + DQUOT_FREE_BLOCK(inode, 1);
> > > > + goto cleanup;
> > > > +
> > > > bad_block:
> > > > ext3_error(inode->i_sb, __FUNCTION__,
> > > > "inode %ld: bad block %d", inode->i_ino,
> > >
> > > looks good. Can this please be added?
> >
> > Yup. But nobody has sent the equivalent ext2 fix yet?
>
> hmm, what about this one?
I have already made a fix and sent it to Andreas and linux-fsdevel.
For ext2 it's actually a bit more complicated because ext2_sync_inode()
can return with ENOSPC (because do_writepages() need not be able to
write the dirty data of the inode) but inode would be written and hence
in that case we should not release the quota (and we should release the
old xattr block properly). Andreas proposed to just call write_inode()
instead of ext2_sync_inode() to avoid the ENOSPC case but then we might
end up with inconsistency between inode metadata and indirect blocks for
SYNC inode (though the only way I see how this can happen is that we
race against file write and the short time inconsistency might be
bearable...).
I send a combination of mine and Herbert's patch.

Honza
--
Jan Kara <jack@suse.cz>
SuSE CR Labs

Fix a subtle bug in error handling of ext2 xattrs. When ext2_sync_inode() fails
because of ENOSPC (it could not write inode's dirty data) we want to keep
xattrs in a consistent state and release the old block properly.

Signed-off-by: Jan Kara <jack@suse.cz>

--- linux/fs/ext2/xattr.c 2005-01-27 12:56:25.782729816 +0100
+++ linux/fs/ext2/xattr.c 2005-01-27 13:14:21.196242112 +0100
@@ -706,8 +706,14 @@
inode->i_ctime = CURRENT_TIME_SEC;
if (IS_SYNC(inode)) {
error = ext2_sync_inode (inode);
- if (error)
+ /* In case sync failed due to ENOSPC the inode was actually
+ * written (only some dirty data were not) so we just proceed
+ * as if nothing happened and cleanup the unused block */
+ if (error && error != ENOSPC) {
+ if (new_bh && new_bh != old_bh)
+ DQUOT_FREE_BLOCK(inode, 1);
goto cleanup;
+ }
} else
mark_inode_dirty(inode);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:09    [W:0.047 / U:0.540 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site