Commit 2e6c97ea authored by Jan Kara's avatar Jan Kara

reiserfs: Handle error from dquot_initialize()

dquot_initialize() can now return error. Handle it where possible.
Signed-off-by: default avatarJan Kara <jack@suse.com>
parent 9c89fe0a
...@@ -3319,8 +3319,11 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -3319,8 +3319,11 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
/* must be turned off for recursive notify_change calls */ /* must be turned off for recursive notify_change calls */
ia_valid = attr->ia_valid &= ~(ATTR_KILL_SUID|ATTR_KILL_SGID); ia_valid = attr->ia_valid &= ~(ATTR_KILL_SUID|ATTR_KILL_SGID);
if (is_quota_modification(inode, attr)) if (is_quota_modification(inode, attr)) {
dquot_initialize(inode); error = dquot_initialize(inode);
if (error)
return error;
}
reiserfs_write_lock(inode->i_sb); reiserfs_write_lock(inode->i_sb);
if (attr->ia_valid & ATTR_SIZE) { if (attr->ia_valid & ATTR_SIZE) {
/* /*
......
...@@ -613,8 +613,7 @@ static int new_inode_init(struct inode *inode, struct inode *dir, umode_t mode) ...@@ -613,8 +613,7 @@ static int new_inode_init(struct inode *inode, struct inode *dir, umode_t mode)
* we have to set uid and gid here * we have to set uid and gid here
*/ */
inode_init_owner(inode, dir, mode); inode_init_owner(inode, dir, mode);
dquot_initialize(inode); return dquot_initialize(inode);
return 0;
} }
static int reiserfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, static int reiserfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
...@@ -633,12 +632,18 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, umode_t mod ...@@ -633,12 +632,18 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, umode_t mod
struct reiserfs_transaction_handle th; struct reiserfs_transaction_handle th;
struct reiserfs_security_handle security; struct reiserfs_security_handle security;
dquot_initialize(dir); retval = dquot_initialize(dir);
if (retval)
return retval;
if (!(inode = new_inode(dir->i_sb))) { if (!(inode = new_inode(dir->i_sb))) {
return -ENOMEM; return -ENOMEM;
} }
new_inode_init(inode, dir, mode); retval = new_inode_init(inode, dir, mode);
if (retval) {
drop_new_inode(inode);
return retval;
}
jbegin_count += reiserfs_cache_default_acl(dir); jbegin_count += reiserfs_cache_default_acl(dir);
retval = reiserfs_security_init(dir, inode, &dentry->d_name, &security); retval = reiserfs_security_init(dir, inode, &dentry->d_name, &security);
...@@ -710,12 +715,18 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode ...@@ -710,12 +715,18 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode
if (!new_valid_dev(rdev)) if (!new_valid_dev(rdev))
return -EINVAL; return -EINVAL;
dquot_initialize(dir); retval = dquot_initialize(dir);
if (retval)
return retval;
if (!(inode = new_inode(dir->i_sb))) { if (!(inode = new_inode(dir->i_sb))) {
return -ENOMEM; return -ENOMEM;
} }
new_inode_init(inode, dir, mode); retval = new_inode_init(inode, dir, mode);
if (retval) {
drop_new_inode(inode);
return retval;
}
jbegin_count += reiserfs_cache_default_acl(dir); jbegin_count += reiserfs_cache_default_acl(dir);
retval = reiserfs_security_init(dir, inode, &dentry->d_name, &security); retval = reiserfs_security_init(dir, inode, &dentry->d_name, &security);
...@@ -787,7 +798,9 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode ...@@ -787,7 +798,9 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb)); REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
dquot_initialize(dir); retval = dquot_initialize(dir);
if (retval)
return retval;
#ifdef DISPLACE_NEW_PACKING_LOCALITIES #ifdef DISPLACE_NEW_PACKING_LOCALITIES
/* /*
...@@ -800,7 +813,11 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode ...@@ -800,7 +813,11 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
if (!(inode = new_inode(dir->i_sb))) { if (!(inode = new_inode(dir->i_sb))) {
return -ENOMEM; return -ENOMEM;
} }
new_inode_init(inode, dir, mode); retval = new_inode_init(inode, dir, mode);
if (retval) {
drop_new_inode(inode);
return retval;
}
jbegin_count += reiserfs_cache_default_acl(dir); jbegin_count += reiserfs_cache_default_acl(dir);
retval = reiserfs_security_init(dir, inode, &dentry->d_name, &security); retval = reiserfs_security_init(dir, inode, &dentry->d_name, &security);
...@@ -899,7 +916,9 @@ static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry) ...@@ -899,7 +916,9 @@ static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry)
JOURNAL_PER_BALANCE_CNT * 2 + 2 + JOURNAL_PER_BALANCE_CNT * 2 + 2 +
4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb);
dquot_initialize(dir); retval = dquot_initialize(dir);
if (retval)
return retval;
reiserfs_write_lock(dir->i_sb); reiserfs_write_lock(dir->i_sb);
retval = journal_begin(&th, dir->i_sb, jbegin_count); retval = journal_begin(&th, dir->i_sb, jbegin_count);
...@@ -985,7 +1004,9 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry) ...@@ -985,7 +1004,9 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry)
int jbegin_count; int jbegin_count;
unsigned long savelink; unsigned long savelink;
dquot_initialize(dir); retval = dquot_initialize(dir);
if (retval)
return retval;
inode = d_inode(dentry); inode = d_inode(dentry);
...@@ -1095,12 +1116,18 @@ static int reiserfs_symlink(struct inode *parent_dir, ...@@ -1095,12 +1116,18 @@ static int reiserfs_symlink(struct inode *parent_dir,
2 * (REISERFS_QUOTA_INIT_BLOCKS(parent_dir->i_sb) + 2 * (REISERFS_QUOTA_INIT_BLOCKS(parent_dir->i_sb) +
REISERFS_QUOTA_TRANS_BLOCKS(parent_dir->i_sb)); REISERFS_QUOTA_TRANS_BLOCKS(parent_dir->i_sb));
dquot_initialize(parent_dir); retval = dquot_initialize(parent_dir);
if (retval)
return retval;
if (!(inode = new_inode(parent_dir->i_sb))) { if (!(inode = new_inode(parent_dir->i_sb))) {
return -ENOMEM; return -ENOMEM;
} }
new_inode_init(inode, parent_dir, mode); retval = new_inode_init(inode, parent_dir, mode);
if (retval) {
drop_new_inode(inode);
return retval;
}
retval = reiserfs_security_init(parent_dir, inode, &dentry->d_name, retval = reiserfs_security_init(parent_dir, inode, &dentry->d_name,
&security); &security);
...@@ -1184,7 +1211,9 @@ static int reiserfs_link(struct dentry *old_dentry, struct inode *dir, ...@@ -1184,7 +1211,9 @@ static int reiserfs_link(struct dentry *old_dentry, struct inode *dir,
JOURNAL_PER_BALANCE_CNT * 3 + JOURNAL_PER_BALANCE_CNT * 3 +
2 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); 2 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb);
dquot_initialize(dir); retval = dquot_initialize(dir);
if (retval)
return retval;
reiserfs_write_lock(dir->i_sb); reiserfs_write_lock(dir->i_sb);
if (inode->i_nlink >= REISERFS_LINK_MAX) { if (inode->i_nlink >= REISERFS_LINK_MAX) {
...@@ -1308,8 +1337,12 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -1308,8 +1337,12 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
JOURNAL_PER_BALANCE_CNT * 3 + 5 + JOURNAL_PER_BALANCE_CNT * 3 + 5 +
4 * REISERFS_QUOTA_TRANS_BLOCKS(old_dir->i_sb); 4 * REISERFS_QUOTA_TRANS_BLOCKS(old_dir->i_sb);
dquot_initialize(old_dir); retval = dquot_initialize(old_dir);
dquot_initialize(new_dir); if (retval)
return retval;
retval = dquot_initialize(new_dir);
if (retval)
return retval;
old_inode = d_inode(old_dentry); old_inode = d_inode(old_dentry);
new_dentry_inode = d_inode(new_dentry); new_dentry_inode = d_inode(new_dentry);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment