linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: agruen@suse.de
Cc: linux-fsdevel@vger.kernel.org
Subject: Ext2 xattr error handling
Date: Mon, 24 Jan 2005 12:22:46 +0100	[thread overview]
Message-ID: <20050124112246.GA13560@atrey.karlin.mff.cuni.cz> (raw)

  Hi!

  I think there's a subtle bug in handling of errors when
creating xattrs in ext2. In ext2_xattr_set2() if inode is marked for SYNC
ext2_sync_inode() is called. It can fail and then the state of xattrs is
inconsistent (actually it depends on the place at which the sync fails -
if inode itself cannot be written then it's probably an IO error and we
don't care to much but sync can fail also because of ENOSPC and in such
case we should proceed more gracefully). The attached patch should fix
that.
								Honza

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


Fix a subtle bug in error handling. When ext2_sync_inode() fails because
of ENOSPC we want to keep xattrs in consistent state and release the old
block properly.

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

--- linux-2.6-linus/fs/ext2/xattr.c	2005-01-24 12:52:18.000000000 +0100
+++ linux-2.6-linus/fs/ext2/xattr.c	2005-01-24 14:19:49.635103592 +0100
@@ -706,8 +706,11 @@
 	inode->i_ctime = CURRENT_TIME_SEC;
 	if (IS_SYNC(inode)) {
 		error = ext2_sync_inode (inode);
-		if (error)
+		if (error != ENOSPC)
 			goto cleanup;
+		/* 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 */
 	} else
 		mark_inode_dirty(inode);
 

             reply	other threads:[~2005-01-24 11:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-24 11:22 Jan Kara [this message]
2005-01-26 13:24 ` Ext2 xattr error handling Andreas Gruenbacher

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=20050124112246.GA13560@atrey.karlin.mff.cuni.cz \
    --to=jack@suse.cz \
    --cc=agruen@suse.de \
    --cc=linux-fsdevel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).