Signed-off-by: Dmitry Monakhov <dmonakhov@xxxxxxxxxx> --- fs/jfs/file.c | 7 ++++- fs/jfs/jfs_inode.c | 5 +++- fs/jfs/namei.c | 59 +++++++++++++++++++++++++++++++++++++-------------- 3 files changed, 52 insertions(+), 19 deletions(-) diff --git a/fs/jfs/file.c b/fs/jfs/file.c index 85d9ec6..cb0da27 100644 --- a/fs/jfs/file.c +++ b/fs/jfs/file.c @@ -98,8 +98,11 @@ int jfs_setattr(struct dentry *dentry, struct iattr *iattr) if (rc) return rc; - if (is_quota_modification(inode, iattr)) - dquot_initialize(inode); + if (is_quota_modification(inode, iattr)) { + rc = dquot_initialize(inode); + if (rc) + return rc; + } if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { rc = dquot_transfer(inode, iattr); diff --git a/fs/jfs/jfs_inode.c b/fs/jfs/jfs_inode.c index 829921b..8d18c95 100644 --- a/fs/jfs/jfs_inode.c +++ b/fs/jfs/jfs_inode.c @@ -116,7 +116,10 @@ struct inode *ialloc(struct inode *parent, umode_t mode) /* * Allocate inode to quota. */ - dquot_initialize(inode); + rc = dquot_initialize(inode); + if (rc) + goto fail_unlock; + rc = dquot_alloc_inode(inode); if (rc) goto fail_drop; diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c index a9cf8e8..96d40a6 100644 --- a/fs/jfs/namei.c +++ b/fs/jfs/namei.c @@ -85,7 +85,9 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, int mode, jfs_info("jfs_create: dip:0x%p name:%s", dip, dentry->d_name.name); - dquot_initialize(dip); + rc = dquot_initialize(dip); + if (rc) + goto out1; /* * search parent directory for entry/freespace @@ -217,7 +219,9 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode) jfs_info("jfs_mkdir: dip:0x%p name:%s", dip, dentry->d_name.name); - dquot_initialize(dip); + rc = dquot_initialize(dip); + if (rc) + goto out1; /* link count overflow on parent directory ? */ if (dip->i_nlink == JFS_LINK_MAX) { @@ -360,8 +364,12 @@ static int jfs_rmdir(struct inode *dip, struct dentry *dentry) jfs_info("jfs_rmdir: dip:0x%p name:%s", dip, dentry->d_name.name); /* Init inode for quota operations. */ - dquot_initialize(dip); - dquot_initialize(ip); + rc = dquot_initialize(dip); + if (rc) + goto out; + rc = dquot_initialize(ip); + if (rc) + goto out; /* directory must be empty to be removed */ if (!dtEmpty(ip)) { @@ -488,8 +496,12 @@ static int jfs_unlink(struct inode *dip, struct dentry *dentry) jfs_info("jfs_unlink: dip:0x%p name:%s", dip, dentry->d_name.name); /* Init inode for quota operations. */ - dquot_initialize(dip); - dquot_initialize(ip); + rc = dquot_initialize(dip); + if (rc) + goto out; + rc = dquot_initialize(ip); + if (rc) + goto out; if ((rc = get_UCSname(&dname, dentry))) goto out; @@ -811,7 +823,9 @@ static int jfs_link(struct dentry *old_dentry, if (ip->i_nlink == 0) return -ENOENT; - dquot_initialize(dir); + rc = dquot_initialize(dir); + if (rc) + return rc; tid = txBegin(ip->i_sb, 0); @@ -904,7 +918,9 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry, jfs_info("jfs_symlink: dip:0x%p name:%s", dip, name); - dquot_initialize(dip); + rc = dquot_initialize(dip); + if(rc) + goto out1; ssize = strlen(name) + 1; @@ -1097,12 +1113,24 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, jfs_info("jfs_rename: %s %s", old_dentry->d_name.name, new_dentry->d_name.name); - dquot_initialize(old_dir); - dquot_initialize(new_dir); - old_ip = old_dentry->d_inode; new_ip = new_dentry->d_inode; + /* Init inode for quota operations. */ + rc = dquot_initialize(old_dir); + if (rc) + goto out1; + + rc = dquot_initialize(new_dir); + if(rc) + goto out1; + + if (new_ip) { + rc = dquot_initialize(new_ip); + if(rc) + goto out1; + } + if ((rc = get_UCSname(&old_dname, old_dentry))) goto out1; @@ -1146,11 +1174,8 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, rc = -EMLINK; goto out3; } - } else if (new_ip) { + } else if (new_ip) IWRITE_LOCK(new_ip, RDWRLOCK_NORMAL); - /* Init inode for quota operations. */ - dquot_initialize(new_ip); - } /* * The real work starts here @@ -1373,7 +1398,9 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry, jfs_info("jfs_mknod: %s", dentry->d_name.name); - dquot_initialize(dir); + rc = dquot_initialize(dir); + if (rc) + goto out; if ((rc = get_UCSname(&dname, dentry))) goto out; -- 1.6.6.1 -- 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