mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Herbert Poetzl <herbert@13thfloor.at>
To: Andrew Morton <akpm@osdl.org>
Cc: Andreas Gruenbacher <agruen@suse.de>,
	torvalds@osdl.org, linux-kernel@vger.kernel.org, jack@suse.cz
Subject: Re: 2.6.11-rc2/ext3 quota allocation bug on error path ...
Date: Wed, 26 Jan 2005 23:41:16 +0100	[thread overview]
Message-ID: <20050126224116.GA20720@mail.13thfloor.at> (raw)
In-Reply-To: <20050126112430.2daf812d.akpm@osdl.org>

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?

diff -NurpP --minimal linux-2.6.11-rc2/fs/ext2/xattr.c linux-2.6.11-rc2-fixed/fs/ext2/xattr.c
--- linux-2.6.11-rc2/fs/ext2/xattr.c	2005-01-22 15:07:50 +0100
+++ linux-2.6.11-rc2-fixed/fs/ext2/xattr.c	2005-01-26 22:40:28 +0100
@@ -706,8 +706,11 @@ ext2_xattr_set2(struct inode *inode, str
 	inode->i_ctime = CURRENT_TIME_SEC;
 	if (IS_SYNC(inode)) {
 		error = ext2_sync_inode (inode);
-		if (error)
+		if (error) {
+			if (new_bh && new_bh != old_bh) 
+				DQUOT_FREE_BLOCK(inode, 1);
 			goto cleanup;
+		}
 	} else
 		mark_inode_dirty(inode);
 
@@ -748,7 +751,6 @@ ext2_xattr_set2(struct inode *inode, str
 
 cleanup:
 	brelse(new_bh);
-
 	return error;
 }
 


and here the ext3 fix again:


Signed-off-by: Herbert Pötzl <herbert@13thfloor.at>

diff -NurpP --minimal linux-2.6.11-rc2/fs/ext3/xattr.c linux-2.6.11-rc2-fixed/fs/ext3/xattr.c
--- linux-2.6.11-rc2/fs/ext3/xattr.c	2005-01-22 15:07:50 +0100
+++ linux-2.6.11-rc2-fixed/fs/ext3/xattr.c	2005-01-26 22:19:29 +0100
@@ -773,7 +773,7 @@ inserted:
 				error = ext3_journal_get_write_access(handle,
 								      new_bh);
 				if (error)
-					goto cleanup;
+					goto cleanup_dquot;
 				lock_buffer(new_bh);
 				BHDR(new_bh)->h_refcount = cpu_to_le32(1 +
 					le32_to_cpu(BHDR(new_bh)->h_refcount));
@@ -783,7 +783,7 @@ inserted:
 				error = ext3_journal_dirty_metadata(handle,
 								    new_bh);
 				if (error)
-					goto cleanup;
+					goto cleanup_dquot;
 			}
 			mb_cache_entry_release(ce);
 			ce = NULL;
@@ -844,6 +844,10 @@ cleanup:
 
 	return error;
 
+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,


best,
Herbert

  reply	other threads:[~2005-01-27  0:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-22 15:50 Herbert Poetzl
2005-01-24 10:14 ` Jan Kara
2005-01-26 18:32 ` Andreas Gruenbacher
2005-01-26 19:24   ` Andrew Morton
2005-01-26 22:41     ` Herbert Poetzl [this message]
2005-01-27 10:39       ` Jan Kara

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=20050126224116.GA20720@mail.13thfloor.at \
    --to=herbert@13thfloor.at \
    --cc=agruen@suse.de \
    --cc=akpm@osdl.org \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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

Powered by JetHome