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 06/12] udf: add error handling for dquot_initialize
Date: Thu, 20 May 2010 19:34:47 +0200	[thread overview]
Message-ID: <20100520173446.GK3395@quack.suse.cz> (raw)
In-Reply-To: <1274248928-5113-7-git-send-email-dmonakhov@openvz.org>

On Wed 19-05-10 10:02:02, Dmitry Monakhov wrote:
  This is the same case as ufs. Quota support is non-functional for several
years so I already have a patch to remove all the quota code from it.

								Honza
> 
> Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
> ---
>  fs/udf/file.c   |    6 ++++--
>  fs/udf/ialloc.c |   18 +++++++++++-------
>  fs/udf/namei.c  |   39 +++++++++++++++++++++++++++++----------
>  3 files changed, 44 insertions(+), 19 deletions(-)
> 
> diff --git a/fs/udf/file.c b/fs/udf/file.c
> index 6ebc043..1ef70d6 100644
> --- a/fs/udf/file.c
> +++ b/fs/udf/file.c
> @@ -227,8 +227,10 @@ int udf_setattr(struct dentry *dentry, struct iattr *iattr)
>  	if (error)
>  		return error;
>  
> -	if (is_quota_modification(inode, iattr))
> -		dquot_initialize(inode);
> +	if (is_quota_modification(inode, iattr)) {
> +		error = dquot_initialize(inode);
> +		return error;
> +	}
>  
>  	if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
>              (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
> diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c
> index fb68c9c..dc78998 100644
> --- a/fs/udf/ialloc.c
> +++ b/fs/udf/ialloc.c
> @@ -153,17 +153,21 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
>  	insert_inode_hash(inode);
>  	mark_inode_dirty(inode);
>  
> -	dquot_initialize(inode);
> +	ret = dquot_initialize(inode);
> +	if (ret)
> +		goto out_put;
>  	ret = dquot_alloc_inode(inode);
>  	if (ret) {
>  		dquot_drop(inode);
> -		inode->i_flags |= S_NOQUOTA;
> -		inode->i_nlink = 0;
> -		iput(inode);
> -		*err = ret;
> -		return NULL;
> +		goto out_put;
>  	}
> -
>  	*err = 0;
>  	return inode;
> +out_put:
> +	inode->i_flags |= S_NOQUOTA;
> +	clear_nlink(inode);
> +	iput(inode);
> +	*err = ret;
> +	return NULL;
> +
>  }
> diff --git a/fs/udf/namei.c b/fs/udf/namei.c
> index 7581602..0cb8167 100644
> --- a/fs/udf/namei.c
> +++ b/fs/udf/namei.c
> @@ -563,7 +563,9 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode,
>  	int err;
>  	struct udf_inode_info *iinfo;
>  
> -	dquot_initialize(dir);
> +	err = dquot_initialize(dir);
> +	if (err)
> +		return err;
>  
>  	lock_kernel();
>  	inode = udf_new_inode(dir, mode, &err);
> @@ -618,7 +620,9 @@ static int udf_mknod(struct inode *dir, struct dentry *dentry, int mode,
>  	if (!old_valid_dev(rdev))
>  		return -EINVAL;
>  
> -	dquot_initialize(dir);
> +	err = dquot_initialize(dir);
> +	if (err)
> +		return err;
>  
>  	lock_kernel();
>  	err = -EIO;
> @@ -666,7 +670,9 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, int mode)
>  	struct udf_inode_info *dinfo = UDF_I(dir);
>  	struct udf_inode_info *iinfo;
>  
> -	dquot_initialize(dir);
> +	err = dquot_initialize(dir);
> +	if (err)
> +		return err;
>  
>  	lock_kernel();
>  	err = -EMLINK;
> @@ -805,7 +811,9 @@ static int udf_rmdir(struct inode *dir, struct dentry *dentry)
>  	struct fileIdentDesc *fi, cfi;
>  	struct kernel_lb_addr tloc;
>  
> -	dquot_initialize(dir);
> +	retval = dquot_initialize(dir);
> +	if (retval)
> +		return retval;
>  
>  	retval = -ENOENT;
>  	lock_kernel();
> @@ -853,7 +861,9 @@ static int udf_unlink(struct inode *dir, struct dentry *dentry)
>  	struct fileIdentDesc cfi;
>  	struct kernel_lb_addr tloc;
>  
> -	dquot_initialize(dir);
> +	retval = dquot_initialize(dir);
> +	if (retval)
> +		return retval;
>  
>  	retval = -ENOENT;
>  	lock_kernel();
> @@ -909,7 +919,9 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry,
>  	struct buffer_head *bh;
>  	struct udf_inode_info *iinfo;
>  
> -	dquot_initialize(dir);
> +	err = dquot_initialize(dir);
> +	if (err)
> +		return err;
>  
>  	lock_kernel();
>  	inode = udf_new_inode(dir, S_IFLNK, &err);
> @@ -1081,7 +1093,9 @@ static int udf_link(struct dentry *old_dentry, struct inode *dir,
>  	int err;
>  	struct buffer_head *bh;
>  
> -	dquot_initialize(dir);
> +	err = dquot_initialize(dir);
> +	if (err)
> +		return err;
>  
>  	lock_kernel();
>  	if (inode->i_nlink >= (256 << sizeof(inode->i_nlink)) - 1) {
> @@ -1141,13 +1155,18 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry,
>  	struct fileIdentDesc *ofi = NULL, *nfi = NULL, *dir_fi = NULL;
>  	struct fileIdentDesc ocfi, ncfi;
>  	struct buffer_head *dir_bh = NULL;
> -	int retval = -ENOENT;
> +	int retval;
>  	struct kernel_lb_addr tloc;
>  	struct udf_inode_info *old_iinfo = UDF_I(old_inode);
>  
> -	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;
>  
> +	retval = -ENOENT;
>  	lock_kernel();
>  	ofi = udf_find_entry(old_dir, &old_dentry->d_name, &ofibh, &ocfi);
>  	if (ofi) {
> -- 
> 1.6.6.1
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  parent reply	other threads:[~2010-05-20 17:34 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                       ` [PATCH 11/12] ext3: " Jan Kara
2010-05-20 17:34             ` Jan Kara [this message]
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=20100520173446.GK3395@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).