summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2005-06-23 22:01:01 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-24 00:05:19 -0700
commitbd6a1f16fffdfe010fdc2979fd01f12357816762 (patch)
tree528e4ed005ee45936d8d8bd5cc490e0826bd27e9
parent92198f7eaa5df3479341dd8fa20c2c81aa3b1e25 (diff)
downloadop-kernel-dev-bd6a1f16fffdfe010fdc2979fd01f12357816762.zip
op-kernel-dev-bd6a1f16fffdfe010fdc2979fd01f12357816762.tar.gz
[PATCH] reiserfs: add checking of journal_begin() return value
Check return values of journal_begin() and journal_end() in the quota code for reiserfs. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--fs/reiserfs/inode.c6
-rw-r--r--fs/reiserfs/super.c66
2 files changed, 52 insertions, 20 deletions
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 2711dff..073425e 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -2798,7 +2798,9 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) {
struct reiserfs_transaction_handle th;
/* (user+group)*(old+new) structure - we count quota info and , inode write (sb, inode) */
- journal_begin(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2);
+ error = journal_begin(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2);
+ if (error)
+ goto out;
error = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0;
if (error) {
journal_end(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2);
@@ -2811,7 +2813,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) {
if (attr->ia_valid & ATTR_GID)
inode->i_gid = attr->ia_gid;
mark_inode_dirty(inode);
- journal_end(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2);
+ error = journal_end(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2);
}
}
if (!error)
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index aae0779..031577f 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -1841,13 +1841,18 @@ static int reiserfs_statfs (struct super_block * s, struct kstatfs * buf)
static int reiserfs_dquot_initialize(struct inode *inode, int type)
{
struct reiserfs_transaction_handle th;
- int ret;
+ int ret, err;
/* We may create quota structure so we need to reserve enough blocks */
reiserfs_write_lock(inode->i_sb);
- journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS);
+ ret = journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS);
+ if (ret)
+ goto out;
ret = dquot_initialize(inode, type);
- journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS);
+ err = journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS);
+ if (!ret && err)
+ ret = err;
+out:
reiserfs_write_unlock(inode->i_sb);
return ret;
}
@@ -1855,13 +1860,18 @@ static int reiserfs_dquot_initialize(struct inode *inode, int type)
static int reiserfs_dquot_drop(struct inode *inode)
{
struct reiserfs_transaction_handle th;
- int ret;
+ int ret, err;
/* We may delete quota structure so we need to reserve enough blocks */
reiserfs_write_lock(inode->i_sb);
- journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS);
+ ret = journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS);
+ if (ret)
+ goto out;
ret = dquot_drop(inode);
- journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS);
+ err = journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS);
+ if (!ret && err)
+ ret = err;
+out:
reiserfs_write_unlock(inode->i_sb);
return ret;
}
@@ -1869,12 +1879,17 @@ static int reiserfs_dquot_drop(struct inode *inode)
static int reiserfs_write_dquot(struct dquot *dquot)
{
struct reiserfs_transaction_handle th;
- int ret;
+ int ret, err;
reiserfs_write_lock(dquot->dq_sb);
- journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_TRANS_BLOCKS);
+ ret = journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_TRANS_BLOCKS);
+ if (ret)
+ goto out;
ret = dquot_commit(dquot);
- journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_TRANS_BLOCKS);
+ err = journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_TRANS_BLOCKS);
+ if (!ret && err)
+ ret = err;
+out:
reiserfs_write_unlock(dquot->dq_sb);
return ret;
}
@@ -1882,12 +1897,17 @@ static int reiserfs_write_dquot(struct dquot *dquot)
static int reiserfs_acquire_dquot(struct dquot *dquot)
{
struct reiserfs_transaction_handle th;
- int ret;
+ int ret, err;
reiserfs_write_lock(dquot->dq_sb);
- journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS);
+ ret = journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS);
+ if (ret)
+ goto out;
ret = dquot_acquire(dquot);
- journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS);
+ err = journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS);
+ if (!ret && err)
+ ret = err;
+out:
reiserfs_write_unlock(dquot->dq_sb);
return ret;
}
@@ -1895,12 +1915,17 @@ static int reiserfs_acquire_dquot(struct dquot *dquot)
static int reiserfs_release_dquot(struct dquot *dquot)
{
struct reiserfs_transaction_handle th;
- int ret;
+ int ret, err;
reiserfs_write_lock(dquot->dq_sb);
- journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS);
+ ret = journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS);
+ if (ret)
+ goto out;
ret = dquot_release(dquot);
- journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS);
+ err = journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS);
+ if (!ret && err)
+ ret = err;
+out:
reiserfs_write_unlock(dquot->dq_sb);
return ret;
}
@@ -1920,13 +1945,18 @@ static int reiserfs_mark_dquot_dirty(struct dquot *dquot)
static int reiserfs_write_info(struct super_block *sb, int type)
{
struct reiserfs_transaction_handle th;
- int ret;
+ int ret, err;
/* Data block + inode block */
reiserfs_write_lock(sb);
- journal_begin(&th, sb, 2);
+ ret = journal_begin(&th, sb, 2);
+ if (ret)
+ goto out;
ret = dquot_commit_info(sb, type);
- journal_end(&th, sb, 2);
+ err = journal_end(&th, sb, 2);
+ if (!ret && err)
+ ret = err;
+out:
reiserfs_write_unlock(sb);
return ret;
}
OpenPOWER on IntegriCloud