linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Dmitry Monakhov <dmonakhov@openvz.org>
Cc: linux-fsdevel@vger.kernel.org, jack@suse.cz, hch@infradead.org
Subject: Re: [PATCH 11/12] ext3: add error handling for dquot_initialize
Date: Thu, 20 May 2010 19:32:30 +0200	[thread overview]
Message-ID: <20100520173230.GI3395@quack.suse.cz> (raw)
In-Reply-To: <1274248928-5113-12-git-send-email-dmonakhov@openvz.org>

On Wed 19-05-10 10:02:07, Dmitry Monakhov wrote:
  The patch looks good.

							Honza
> 
> Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
> ---
>  fs/ext3/ialloc.c |    6 +++++-
>  fs/ext3/inode.c  |   19 ++++++++++++++-----
>  fs/ext3/namei.c  |   54 ++++++++++++++++++++++++++++++++++++++++--------------
>  fs/ext3/super.c  |    9 ++++++++-
>  4 files changed, 67 insertions(+), 21 deletions(-)
> 
> diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c
> index 0d0e97e..6757cde 100644
> --- a/fs/ext3/ialloc.c
> +++ b/fs/ext3/ialloc.c
> @@ -590,7 +590,11 @@ got:
>  		sizeof(struct ext3_inode) - EXT3_GOOD_OLD_INODE_SIZE : 0;
>  
>  	ret = inode;
> -	dquot_initialize(inode);
> +
> +	err = dquot_initialize(inode);
> +	if (err)
> +		goto fail_drop;
> +
>  	err = dquot_alloc_inode(inode);
>  	if (err)
>  		goto fail_drop;
> diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
> index 735f019..8497b03 100644
> --- a/fs/ext3/inode.c
> +++ b/fs/ext3/inode.c
> @@ -196,9 +196,15 @@ void ext3_delete_inode (struct inode * inode)
>  {
>  	handle_t *handle;
>  
> -	if (!is_bad_inode(inode))
> -		dquot_initialize(inode);
> -
> +	if (!is_bad_inode(inode)) {
> +		int ret = dquot_initialize(inode);
> +		if (ret)
> +			ext3_error(inode->i_sb, __func__, "Fail to init_quota "
> +				"for inode %lu, uid %d, gid:%d, error%d, thus "
> +				"quota information is probably inconsistent,  "
> +				"Please run quotacheck(8)", inode->i_ino,
> +				inode->i_uid, inode->i_gid, ret);
> +	}
>  	truncate_inode_pages(&inode->i_data, 0);
>  
>  	if (is_bad_inode(inode))
> @@ -3151,8 +3157,11 @@ int ext3_setattr(struct dentry *dentry, struct iattr *attr)
>  	if (error)
>  		return error;
>  
> -	if (is_quota_modification(inode, attr))
> -		dquot_initialize(inode);
> +	if (is_quota_modification(inode, attr)) {
> +		error = dquot_initialize(inode);
> +		if (error)
> +			return error;
> +	}
>  	if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
>  		(ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
>  		handle_t *handle;
> diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
> index ee18408..4813ebf 100644
> --- a/fs/ext3/namei.c
> +++ b/fs/ext3/namei.c
> @@ -1696,8 +1696,9 @@ static int ext3_create (struct inode * dir, struct dentry * dentry, int mode,
>  	struct inode * inode;
>  	int err, retries = 0;
>  
> -	dquot_initialize(dir);
> -
> +	err = dquot_initialize(dir);
> +	if (err)
> +		return err;
>  retry:
>  	handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) +
>  					EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 +
> @@ -1732,7 +1733,9 @@ static int ext3_mknod (struct inode * dir, struct dentry *dentry,
>  	if (!new_valid_dev(rdev))
>  		return -EINVAL;
>  
> -	dquot_initialize(dir);
> +	err = dquot_initialize(dir);
> +	if (err)
> +		return err;
>  
>  retry:
>  	handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) +
> @@ -1770,7 +1773,9 @@ static int ext3_mkdir(struct inode * dir, struct dentry * dentry, int mode)
>  	if (dir->i_nlink >= EXT3_LINK_MAX)
>  		return -EMLINK;
>  
> -	dquot_initialize(dir);
> +	err = dquot_initialize(dir);
> +	if (err)
> +		return err;
>  
>  retry:
>  	handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) +
> @@ -2066,8 +2071,13 @@ static int ext3_rmdir (struct inode * dir, struct dentry *dentry)
>  
>  	/* Initialize quotas before so that eventual writes go in
>  	 * separate transaction */
> -	dquot_initialize(dir);
> -	dquot_initialize(dentry->d_inode);
> +	retval = dquot_initialize(dir);
> +	if (retval)
> +		return retval;
> +
> +	retval = dquot_initialize(dentry->d_inode);
> +	if (retval)
> +		return retval;
>  
>  	handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb));
>  	if (IS_ERR(handle))
> @@ -2127,8 +2137,13 @@ static int ext3_unlink(struct inode * dir, struct dentry *dentry)
>  
>  	/* Initialize quotas before so that eventual writes go
>  	 * in separate transaction */
> -	dquot_initialize(dir);
> -	dquot_initialize(dentry->d_inode);
> +	retval = dquot_initialize(dir);
> +	if (retval)
> +		return retval;
> +
> +	retval = dquot_initialize(dentry->d_inode);
> +	if (retval)
> +		return retval;
>  
>  	handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb));
>  	if (IS_ERR(handle))
> @@ -2184,7 +2199,9 @@ static int ext3_symlink (struct inode * dir,
>  	if (l > dir->i_sb->s_blocksize)
>  		return -ENAMETOOLONG;
>  
> -	dquot_initialize(dir);
> +	err = dquot_initialize(dir);
> +	if (err)
> +		return err;
>  
>  retry:
>  	handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) +
> @@ -2241,7 +2258,9 @@ static int ext3_link (struct dentry * old_dentry,
>  	if (inode->i_nlink >= EXT3_LINK_MAX)
>  		return -EMLINK;
>  
> -	dquot_initialize(dir);
> +	err = dquot_initialize(dir);
> +	if (err)
> +		return err;
>  
>  	/*
>  	 * Return -ENOENT if we've raced with unlink and i_nlink is 0.  Doing
> @@ -2293,15 +2312,22 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry,
>  	struct ext3_dir_entry_2 * old_de, * new_de;
>  	int retval, flush_file = 0;
>  
> -	dquot_initialize(old_dir);
> -	dquot_initialize(new_dir);
> +	retval = dquot_initialize(old_dir);
> +	if (retval)
> +		return retval;
> +	retval = dquot_initialize(new_dir);
> +	if (retval)
> +		return retval;
>  
>  	old_bh = new_bh = dir_bh = NULL;
>  
>  	/* Initialize quotas before so that eventual writes go
>  	 * in separate transaction */
> -	if (new_dentry->d_inode)
> -		dquot_initialize(new_dentry->d_inode);
> +	if (new_dentry->d_inode) {
> +		retval = dquot_initialize(new_dentry->d_inode);
> +		if (retval)
> +			return retval;
> +	}
>  	handle = ext3_journal_start(old_dir, 2 *
>  					EXT3_DATA_TRANS_BLOCKS(old_dir->i_sb) +
>  					EXT3_INDEX_EXTRA_TRANS_BLOCKS + 2);
> diff --git a/fs/ext3/super.c b/fs/ext3/super.c
> index 5ca068f..dd17196 100644
> --- a/fs/ext3/super.c
> +++ b/fs/ext3/super.c
> @@ -1498,7 +1498,14 @@ static int ext3_orphan_cleanup (struct super_block * sb,
>  		}
>  
>  		list_add(&EXT3_I(inode)->i_orphan, &EXT3_SB(sb)->s_orphan);
> -		dquot_initialize(inode);
> +		ret = dquot_initialize(inode);
> +		if (ret) {
> +			ext3_msg(sb, KERN_ERR, "Can not initialize quota for "
> +				"inode:%lu error %d",
> +				inode->i_ino, ret);
> +			if (!test_opt (sb, ERRORS_CONT))
> +				goto out;
> +		}
>  		if (inode->i_nlink) {
>  			printk(KERN_DEBUG
>  				"%s: truncating inode %lu to %Ld bytes\n",
> -- 
> 1.6.6.1
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  parent reply	other threads:[~2010-05-20 17:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-19  6:01 [PATCH 00/12] quota: Redesign IO error handling interface V2 Dmitry Monakhov
2010-05-19  6:01 ` [PATCH 01/12] quota: Add proper error handling on quota initialization Dmitry Monakhov
2010-05-19  6:01   ` [PATCH 02/12] quota: Check what quota is properly initialized for inode before charge Dmitry Monakhov
2010-05-19  6:01     ` [PATCH 03/12] ext3: handle errors in orphan_cleanup Dmitry Monakhov
2010-05-19  6:02       ` [PATCH 04/12] ext4: " Dmitry Monakhov
2010-05-19  6:02         ` [PATCH 05/12] ufs: add error handling for dquot_initialize Dmitry Monakhov
2010-05-19  6:02           ` [PATCH 06/12] udf: " Dmitry Monakhov
2010-05-19  6:02             ` [PATCH 07/12] reiserfs: " Dmitry Monakhov
2010-05-19  6:02               ` [PATCH 08/12] ocfs2: " Dmitry Monakhov
2010-05-19  6:02                 ` [PATCH 09/12] jfs: " Dmitry Monakhov
2010-05-19  6:02                   ` [PATCH 10/12] ext4: " Dmitry Monakhov
2010-05-19  6:02                     ` [PATCH 11/12] ext3: " Dmitry Monakhov
2010-05-19  6:02                       ` [PATCH 12/12] ext2: " Dmitry Monakhov
2010-05-20 17:30                         ` Jan Kara
2010-05-20 17:32                       ` Jan Kara [this message]
2010-05-20 17:34             ` [PATCH 06/12] udf: " Jan Kara
2010-05-20 17:33           ` [PATCH 05/12] ufs: " Jan Kara
2010-05-20 17:35       ` [PATCH 03/12] ext3: handle errors in orphan_cleanup Jan Kara
2010-05-20 18:13     ` [PATCH 02/12] quota: Check what quota is properly initialized for inode before charge Jan Kara
2010-05-20 18:05   ` [PATCH 01/12] quota: Add proper error handling on quota initialization 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=20100520173230.GI3395@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=dmonakhov@openvz.org \
    --cc=hch@infradead.org \
    --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).