From: Dmitry Monakhov <dmonakhov@openvz.org>
To: linux-fsdevel@vger.kernel.org
Cc: jack@suse.cz, hch@infradead.org, Dmitry Monakhov <dmonakhov@openvz.org>
Subject: [PATCH 09/12] jfs: add error handling for dquot_initialize
Date: Wed, 19 May 2010 10:02:05 +0400 [thread overview]
Message-ID: <1274248928-5113-10-git-send-email-dmonakhov@openvz.org> (raw)
In-Reply-To: <1274248928-5113-9-git-send-email-dmonakhov@openvz.org>
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
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
next prev parent reply other threads:[~2010-05-19 6:02 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 ` Dmitry Monakhov [this message]
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 ` [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=1274248928-5113-10-git-send-email-dmonakhov@openvz.org \
--to=dmonakhov@openvz.org \
--cc=hch@infradead.org \
--cc=jack@suse.cz \
--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).