From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Gruenbacher Subject: Re: Ext2 xattr error handling Date: Wed, 26 Jan 2005 14:24:28 +0100 Message-ID: <1106745867.13004.20.camel@winden.suse.de> References: <20050124112246.GA13560@atrey.karlin.mff.cuni.cz> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: "linux-fsdevel@vger.kernel.org" Return-path: Received: from hermes-ext.suse.de ([195.135.221.8]:9181 "EHLO hermes.suse.de") by vger.kernel.org with ESMTP id S262291AbVAZNY2 (ORCPT ); Wed, 26 Jan 2005 08:24:28 -0500 To: Jan Kara In-Reply-To: <20050124112246.GA13560@atrey.karlin.mff.cuni.cz> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Mon, 2005-01-24 at 12:22, Jan Kara wrote: > 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. It should probably just do this, no? Index: linux-2.6.11-latest/fs/ext2/xattr.c =================================================================== --- linux-2.6.11-latest.orig/fs/ext2/xattr.c +++ linux-2.6.11-latest/fs/ext2/xattr.c @@ -705,7 +705,7 @@ ext2_xattr_set2(struct inode *inode, str EXT2_I(inode)->i_file_acl = new_bh ? new_bh->b_blocknr : 0; inode->i_ctime = CURRENT_TIME_SEC; if (IS_SYNC(inode)) { - error = ext2_sync_inode (inode); + error = ext2_write_inode(inode, 1); if (error) goto cleanup; } else Cheers, -- Andreas Gruenbacher SUSE Labs, SUSE LINUX GMBH