Re: [PATCH 05/12] ufs: 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:01, Dmitry Monakhov wrote:
  This patch won't be needed because quota support for ufs is
non-functional for several years and we're going to remove it soon...

							Honza
> 
> Signed-off-by: Dmitry Monakhov <dmonakhov@xxxxxxxxxx>
> ---
>  fs/ufs/ialloc.c   |    5 ++++-
>  fs/ufs/namei.c    |   46 +++++++++++++++++++++++++++++++++-------------
>  fs/ufs/truncate.c |    6 ++++--
>  3 files changed, 41 insertions(+), 16 deletions(-)
> 
> diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c
> index 230ecf6..33e6fab 100644
> --- a/fs/ufs/ialloc.c
> +++ b/fs/ufs/ialloc.c
> @@ -355,7 +355,10 @@ cg_found:
>  
>  	unlock_super (sb);
>  
> -	dquot_initialize(inode);
> +	err = dquot_initialize(inode);
> +	if (err)
> +		goto fail_without_unlock;
> +
>  	err = dquot_alloc_inode(inode);
>  	if (err) {
>  		dquot_drop(inode);
> diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c
> index eabc02e..94edec7 100644
> --- a/fs/ufs/namei.c
> +++ b/fs/ufs/namei.c
> @@ -86,7 +86,9 @@ static int ufs_create (struct inode * dir, struct dentry * dentry, int mode,
>  
>  	UFSD("BEGIN\n");
>  
> -	dquot_initialize(dir);
> +	err = dquot_initialize(dir);
> +	if (err)
> +		return err;
>  
>  	inode = ufs_new_inode(dir, mode);
>  	err = PTR_ERR(inode);
> @@ -112,7 +114,9 @@ static int ufs_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_t
>  	if (!old_valid_dev(rdev))
>  		return -EINVAL;
>  
> -	dquot_initialize(dir);
> +	err = dquot_initialize(dir);
> +	if (err)
> +		return err;
>  
>  	inode = ufs_new_inode(dir, mode);
>  	err = PTR_ERR(inode);
> @@ -138,7 +142,9 @@ static int ufs_symlink (struct inode * dir, struct dentry * dentry,
>  	if (l > sb->s_blocksize)
>  		goto out_notlocked;
>  
> -	dquot_initialize(dir);
> +	err = dquot_initialize(dir);
> +	if (err)
> +		goto out;
>  
>  	lock_kernel();
>  	inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO);
> @@ -181,17 +187,20 @@ static int ufs_link (struct dentry * old_dentry, struct inode * dir,
>  
>  	lock_kernel();
>  	if (inode->i_nlink >= UFS_LINK_MAX) {
> -		unlock_kernel();
> -		return -EMLINK;
> +		error = -EMLINK;
> +		goto out_unlock;
>  	}
>  
> -	dquot_initialize(dir);
> +	error = dquot_initialize(dir);
> +	if (error)
> +		goto out_unlock;
>  
>  	inode->i_ctime = CURRENT_TIME_SEC;
>  	inode_inc_link_count(inode);
>  	atomic_inc(&inode->i_count);
>  
>  	error = ufs_add_nondir(dentry, inode);
> +out_unlock:
>  	unlock_kernel();
>  	return error;
>  }
> @@ -204,7 +213,9 @@ static int ufs_mkdir(struct inode * dir, struct dentry * dentry, int mode)
>  	if (dir->i_nlink >= UFS_LINK_MAX)
>  		goto out;
>  
> -	dquot_initialize(dir);
> +	err = dquot_initialize(dir);
> +	if (err)
> +		goto out;
>  
>  	lock_kernel();
>  	inode_inc_link_count(dir);
> @@ -248,10 +259,13 @@ static int ufs_unlink(struct inode *dir, struct dentry *dentry)
>  	struct inode * inode = dentry->d_inode;
>  	struct ufs_dir_entry *de;
>  	struct page *page;
> -	int err = -ENOENT;
> +	int err;
>  
> -	dquot_initialize(dir);
> +	err = dquot_initialize(dir);
> +	if (err)
> +		goto out;
>  
> +	err = -ENOENT;
>  	de = ufs_find_entry(dir, &dentry->d_name, &page);
>  	if (!de)
>  		goto out;
> @@ -294,14 +308,20 @@ static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry,
>  	struct ufs_dir_entry * dir_de = NULL;
>  	struct page *old_page;
>  	struct ufs_dir_entry *old_de;
> -	int err = -ENOENT;
> +	int err;
>  
> -	dquot_initialize(old_dir);
> -	dquot_initialize(new_dir);
> +	err = dquot_initialize(old_dir);
> +	if (err)
> +		goto out;
> +	err = dquot_initialize(new_dir);
> +	if (err)
> +		goto out;
>  
>  	old_de = ufs_find_entry(old_dir, &old_dentry->d_name, &old_page);
> -	if (!old_de)
> +	if (!old_de) {
> +		err = -ENOENT;
>  		goto out;
> +	}
>  
>  	if (S_ISDIR(old_inode->i_mode)) {
>  		err = -EIO;
> diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c
> index f294c44..2de89ee 100644
> --- a/fs/ufs/truncate.c
> +++ b/fs/ufs/truncate.c
> @@ -518,8 +518,10 @@ int ufs_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);
> +		return error;
> +	}
>  
>  	if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
>  	    (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
> -- 
> 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