Re: [PATCH 06/12] udf: add error handling for dquot_initialize

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> ---
>  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@xxxxxxx>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux