Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2013-09-12 16:53:40 -0400
committerJeff Mahoney <jeffm@suse.com>2013-09-12 16:53:40 -0400
commit6ddb4dfadf47da7d198274d40bc8e906e352bc6a (patch)
tree5d5c91e309d7d490a3f1d87a8856f98d9a93abfe
parente70a39dd460024adcebabdb8dbb9afadfd01df4d (diff)
- Update
patches.fixes/reiserfs-locking-handle-nested-locks-properly. - Update patches.fixes/reiserfs-locking-push-write-lock-out-of-xattr-code. - Update patches.fixes/reiserfs-locking-release-lock-around-quota-operations. suse-commit: fd0a17821467765e148d55578975e2e22e25d3a4
-rw-r--r--fs/reiserfs/bitmap.c11
-rw-r--r--fs/reiserfs/inode.c28
-rw-r--r--fs/reiserfs/lock.c28
-rw-r--r--fs/reiserfs/namei.c24
-rw-r--r--fs/reiserfs/reiserfs.h54
-rw-r--r--fs/reiserfs/stree.c76
-rw-r--r--fs/reiserfs/super.c28
7 files changed, 101 insertions, 148 deletions
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c
index d56e5e32e8fe..dc9a6829f7c6 100644
--- a/fs/reiserfs/bitmap.c
+++ b/fs/reiserfs/bitmap.c
@@ -1190,8 +1190,7 @@ static inline int blocknrs_and_prealloc_arrays_from_search_start
#endif
/* Free not allocated blocks */
depth = reiserfs_write_unlock_nested(s);
- dquot_free_block_nodirty(
- hint->inode,
+ dquot_free_block_nodirty(hint->inode,
amount_needed + hint->prealloc_size -
nr_allocated);
reiserfs_write_lock_nested(s, depth);
@@ -1225,10 +1224,12 @@ static inline int blocknrs_and_prealloc_arrays_from_search_start
REISERFS_I(hint->inode)->i_prealloc_count,
hint->inode->i_uid);
#endif
+
depth = reiserfs_write_unlock_nested(s);
- dquot_free_block_nodirty(hint->inode,
- amount_needed + hint->prealloc_size - nr_allocated -
- REISERFS_I(hint->inode)->i_prealloc_count);
+ dquot_free_block_nodirty(hint->inode, amount_needed +
+ hint->prealloc_size - nr_allocated -
+ REISERFS_I(hint->inode)->
+ i_prealloc_count);
reiserfs_write_lock_nested(s, depth);
}
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 403e47f04e89..ad62bdbb451e 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -25,7 +25,6 @@ int reiserfs_commit_write(struct file *f, struct page *page,
void reiserfs_evict_inode(struct inode *inode)
{
- struct super_block *sb = inode->i_sb;
/* We need blocks for transaction + (user+group) quota update (possibly delete) */
int jbegin_count =
JOURNAL_PER_BALANCE_CNT * 2 +
@@ -59,9 +58,9 @@ void reiserfs_evict_inode(struct inode *inode)
* after delete_object so that quota updates go into the same transaction as
* stat data deletion */
if (!err) {
- int depth = reiserfs_write_unlock_nested(sb);
+ int depth = reiserfs_write_unlock_nested(inode->i_sb);
dquot_free_inode(inode);
- reiserfs_write_lock_nested(sb, depth);
+ reiserfs_write_lock_nested(inode->i_sb, depth);
}
if (journal_end(&th, inode->i_sb, jbegin_count))
@@ -1527,10 +1526,7 @@ struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key)
if (comp_short_keys(INODE_PKEY(inode), key) || is_bad_inode(inode)) {
/* either due to i/o error or a stale NFS handle */
- int depth;
- depth = reiserfs_write_unlock_nested(s);
iput(inode);
- reiserfs_write_lock_nested(s, depth);
inode = NULL;
}
return inode;
@@ -1547,12 +1543,12 @@ static struct dentry *reiserfs_get_dentry(struct super_block *sb,
key.on_disk_key.k_dir_id = dir_id;
reiserfs_write_lock(sb);
inode = reiserfs_iget(sb, &key);
- reiserfs_write_unlock(sb);
if (inode && !IS_ERR(inode) && generation != 0 &&
generation != inode->i_generation) {
iput(inode);
inode = NULL;
}
+ reiserfs_write_unlock(sb);
return d_obtain_alias(inode);
}
@@ -1775,7 +1771,7 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
struct inode *inode,
struct reiserfs_security_handle *security)
{
- struct super_block *sb;
+ struct super_block *sb = dir->i_sb;
struct reiserfs_iget_args args;
INITIALIZE_PATH(path_to_key);
struct cpu_key key;
@@ -1785,13 +1781,11 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
int err;
int depth;
- reiserfs_check_lock_nested(dir->i_sb, __func__);
-
BUG_ON(!th->t_trans_id);
- depth = reiserfs_write_unlock_nested(dir->i_sb);
+ depth = reiserfs_write_unlock_nested(sb);
err = dquot_alloc_inode(inode);
- reiserfs_write_lock_nested(dir->i_sb, depth);
+ reiserfs_write_lock_nested(sb, depth);
if (err)
goto out_end_trans;
if (!dir->i_nlink) {
@@ -1799,8 +1793,6 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
goto out_bad_inode;
}
- sb = dir->i_sb;
-
/* item head of new item */
ih.ih_key.k_dir_id = reiserfs_choose_packing(dir);
ih.ih_key.k_objectid = cpu_to_le32(reiserfs_get_unused_objectid(th));
@@ -1818,10 +1810,10 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
memcpy(INODE_PKEY(inode), &(ih.ih_key), KEY_SIZE);
args.dirid = le32_to_cpu(ih.ih_key.k_dir_id);
- reiserfs_write_unlock(inode->i_sb);
+ depth = reiserfs_write_unlock_nested(inode->i_sb);
err = insert_inode_locked4(inode, args.objectid,
reiserfs_find_actor, &args);
- reiserfs_write_lock(inode->i_sb);
+ reiserfs_write_lock_nested(inode->i_sb, depth);
if (err) {
err = -EINVAL;
goto out_bad_inode;
@@ -2009,7 +2001,6 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
clear_nlink(inode);
th->t_trans_id = 0; /* so the caller can't use this handle later */
unlock_new_inode(inode); /* OK to do even if we hadn't locked it */
- reiserfs_write_unlock(inode->i_sb);
iput(inode);
return err;
}
@@ -3179,7 +3170,6 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
if ((((attr->ia_valid & ATTR_UID) && (from_kuid(&init_user_ns, attr->ia_uid) & ~0xffff)) ||
((attr->ia_valid & ATTR_GID) && (from_kgid(&init_user_ns, attr->ia_gid) & ~0xffff))) &&
(get_inode_sd_version(inode) == STAT_DATA_V1)) {
- reiserfs_write_unlock(inode->i_sb);
/* stat data of format v3.5 has 16 bit uid and gid */
error = -EINVAL;
goto out;
@@ -3245,7 +3235,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
error = reiserfs_acl_chmod(inode);
}
- out:
+out:
return error;
}
diff --git a/fs/reiserfs/lock.c b/fs/reiserfs/lock.c
index 7a2d253c4a6b..045b83ef9fd9 100644
--- a/fs/reiserfs/lock.c
+++ b/fs/reiserfs/lock.c
@@ -29,9 +29,6 @@ void reiserfs_write_lock(struct super_block *s)
/* No need to protect it, only the current task touches it */
sb_i->lock_depth++;
-#ifdef DEBUG
- inc_preempt_count();
-#endif
}
void reiserfs_write_unlock(struct super_block *s)
@@ -45,9 +42,6 @@ void reiserfs_write_unlock(struct super_block *s)
*/
BUG_ON(sb_i->lock_owner != current);
-#ifdef DEBUG
- dec_preempt_count();
-#endif
if (--sb_i->lock_depth == -1) {
sb_i->lock_owner = NULL;
mutex_unlock(&sb_i->lock);
@@ -58,19 +52,12 @@ int __must_check reiserfs_write_unlock_nested(struct super_block *s)
{
struct reiserfs_sb_info *sb_i = REISERFS_SB(s);
int depth;
-#ifdef DEBUG
- int i;
-#endif
/* this can happen when the lock isn't always held */
if (sb_i->lock_owner != current)
return -1;
depth = sb_i->lock_depth;
-#ifdef DEBUG
- for (i = 0; i <= depth; i++)
- dec_preempt_count();
-#endif
sb_i->lock_depth = -1;
sb_i->lock_owner = NULL;
@@ -82,9 +69,6 @@ int __must_check reiserfs_write_unlock_nested(struct super_block *s)
void reiserfs_write_lock_nested(struct super_block *s, int depth)
{
struct reiserfs_sb_info *sb_i = REISERFS_SB(s);
-#ifdef DEBUG
- int i;
-#endif
/* this can happen when the lock isn't always held */
if (depth == -1)
@@ -93,11 +77,6 @@ void reiserfs_write_lock_nested(struct super_block *s, int depth)
mutex_lock(&sb_i->lock);
sb_i->lock_owner = current;
sb_i->lock_depth = depth;
-
-#ifdef DEBUG
- for (i = 0; i <= depth; i++)
- inc_preempt_count();
-#endif
}
/*
@@ -111,13 +90,6 @@ void reiserfs_check_lock_depth(struct super_block *sb, char *caller)
WARN_ON(sb_i->lock_depth < 0);
}
-void reiserfs_check_lock_nested(struct super_block *sb, const char *caller)
-{
- struct reiserfs_sb_info *sb_i = REISERFS_SB(sb);
-
- WARN_ON(sb_i->lock_depth > 0);
-}
-
#ifdef CONFIG_REISERFS_CHECK
void reiserfs_lock_check_recursive(struct super_block *sb)
{
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index d2067bef56c3..dc5236f6de1b 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -604,9 +604,8 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, umode_t mod
retval =
reiserfs_new_inode(&th, dir, mode, NULL, 0 /*i_size */ , dentry,
inode, &security);
- /* inode is dropped and write lock is released */
if (retval)
- return retval;
+ goto out_failed;
inode->i_op = &reiserfs_file_inode_operations;
inode->i_fop = &reiserfs_file_operations;
@@ -679,9 +678,9 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode
retval =
reiserfs_new_inode(&th, dir, mode, NULL, 0 /*i_size */ , dentry,
inode, &security);
- /* inode is dropped and write lock is released */
- if (retval)
- return retval;
+ if (retval) {
+ goto out_failed;
+ }
inode->i_op = &reiserfs_special_inode_operations;
init_special_inode(inode, inode->i_mode, rdev);
@@ -764,10 +763,9 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
old_format_only(dir->i_sb) ?
EMPTY_DIR_SIZE_V1 : EMPTY_DIR_SIZE,
dentry, inode, &security);
- /* inode is dropped and write lock is released */
if (retval) {
DEC_DIR_INODE_NLINK(dir)
- return retval;
+ goto out_failed;
}
reiserfs_update_inode_transaction(inode);
@@ -789,9 +787,8 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
if (err)
retval = err;
unlock_new_inode(inode);
- reiserfs_write_unlock(dir->i_sb);
iput(inode);
- return retval;
+ goto out_failed;
}
// the above add_entry did not update dir's stat data
reiserfs_update_sd(&th, dir);
@@ -1063,9 +1060,9 @@ static int reiserfs_symlink(struct inode *parent_dir,
reiserfs_new_inode(&th, parent_dir, mode, name, strlen(symname),
dentry, inode, &security);
kfree(name);
- /* inode is dropped and write lock is released */
- if (retval)
- return retval;
+ if (retval) { /* reiserfs_new_inode iputs for us */
+ goto out_failed;
+ }
reiserfs_update_inode_transaction(inode);
reiserfs_update_inode_transaction(parent_dir);
@@ -1087,9 +1084,8 @@ static int reiserfs_symlink(struct inode *parent_dir,
if (err)
retval = err;
unlock_new_inode(inode);
- reiserfs_write_unlock(parent_dir->i_sb);
iput(inode);
- return retval;
+ goto out_failed;
}
unlock_new_inode(inode);
diff --git a/fs/reiserfs/reiserfs.h b/fs/reiserfs/reiserfs.h
index 292d289d6aac..f8adaee537c2 100644
--- a/fs/reiserfs/reiserfs.h
+++ b/fs/reiserfs/reiserfs.h
@@ -13,7 +13,6 @@
#include <linux/bitops.h>
#include <linux/proc_fs.h>
#include <linux/buffer_head.h>
-#include <linux/quotaops.h>
/* the 32 bit compat definitions with int argument */
#define REISERFS_IOC32_UNPACK _IOW(0xCD, 1, int)
@@ -633,7 +632,6 @@ void reiserfs_write_lock(struct super_block *s);
void reiserfs_write_unlock(struct super_block *s);
int __must_check reiserfs_write_unlock_nested(struct super_block *s);
void reiserfs_write_lock_nested(struct super_block *s, int depth);
-void reiserfs_check_lock_nested(struct super_block *s, const char *caller);
#ifdef CONFIG_REISERFS_CHECK
void reiserfs_lock_check_recursive(struct super_block *s);
@@ -668,6 +666,35 @@ static inline void reiserfs_lock_check_recursive(struct super_block *s) { }
* - The journal lock
* - The inode mutex
*/
+static inline void reiserfs_mutex_lock_safe(struct mutex *m,
+ struct super_block *s)
+{
+ int depth;
+
+ depth = reiserfs_write_unlock_nested(s);
+ mutex_lock(m);
+ reiserfs_write_lock_nested(s, depth);
+}
+
+static inline void
+reiserfs_mutex_lock_nested_safe(struct mutex *m, unsigned int subclass,
+ struct super_block *s)
+{
+ int depth;
+
+ depth = reiserfs_write_unlock_nested(s);
+ mutex_lock_nested(m, subclass);
+ reiserfs_write_lock_nested(s, depth);
+}
+
+static inline void
+reiserfs_down_read_safe(struct rw_semaphore *sem, struct super_block *s)
+{
+ int depth;
+ depth = reiserfs_write_unlock_nested(s);
+ down_read(sem);
+ reiserfs_write_lock_nested(s, depth);
+}
/*
* When we schedule, we usually want to also release the write lock,
@@ -676,22 +703,14 @@ static inline void reiserfs_lock_check_recursive(struct super_block *s) { }
static inline void reiserfs_cond_resched(struct super_block *s)
{
if (need_resched()) {
- int depth = reiserfs_write_unlock_nested(s);
+ int depth;
+
+ depth = reiserfs_write_unlock_nested(s);
schedule();
reiserfs_write_lock_nested(s, depth);
}
}
-static inline void reiserfs_mutex_lock_safe(struct mutex *m,
- struct super_block *s)
-{
- int depth;
-
- depth = reiserfs_write_unlock_nested(s);
- mutex_lock(m);
- reiserfs_write_lock_nested(s, depth);
-}
-
struct fid;
/* in reading the #defines, it may help to understand that they employ
@@ -2448,15 +2467,6 @@ int reiserfs_commit_for_inode(struct inode *);
int reiserfs_inode_needs_commit(struct inode *);
void reiserfs_update_inode_transaction(struct inode *);
void reiserfs_wait_on_write_block(struct super_block *s);
-static inline void reiserfs_safe_wait_on_write_block(struct super_block *s)
-{
- int depth;
-
- depth = reiserfs_write_unlock_nested(s);
- reiserfs_wait_on_write_block(s);
- reiserfs_write_lock_nested(s, depth);
-}
-
void reiserfs_block_writes(struct reiserfs_transaction_handle *th);
void reiserfs_allow_writes(struct super_block *s);
void reiserfs_check_lock_depth(struct super_block *s, char *caller);
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
index 0050491c0a9e..b14706a05d52 100644
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -524,14 +524,14 @@ static int is_tree_node(struct buffer_head *bh, int level)
* the caller (search_by_key) will perform other schedule-unsafe
* operations just after calling this function.
*
- * @return true if we have unlocked
+ * @return depth of lock to be restored after read completes
*/
-static bool search_by_key_reada(struct super_block *s,
+static int search_by_key_reada(struct super_block *s,
struct buffer_head **bh,
b_blocknr_t *b, int num)
{
int i, j;
- bool unlocked = false;
+ int depth = -1;
for (i = 0; i < num; i++) {
bh[i] = sb_getblk(s, b[i]);
@@ -549,16 +549,13 @@ static bool search_by_key_reada(struct super_block *s,
* you have to make sure the prepared bit isn't set on this buffer
*/
if (!buffer_uptodate(bh[j])) {
- if (!unlocked) {
- int depth = -1; /* avoiding __must_check */
+ if (depth == -1)
depth = reiserfs_write_unlock_nested(s);
- unlocked = true;
- }
ll_rw_block(READA, 1, bh + j);
}
brelse(bh[j]);
}
- return unlocked;
+ return depth;
}
/**************************************************************************
@@ -626,7 +623,7 @@ int search_by_key(struct super_block *sb, const struct cpu_key *key, /* Key to s
block_number = SB_ROOT_BLOCK(sb);
expected_level = -1;
while (1) {
- int depth;
+
#ifdef CONFIG_REISERFS_CHECK
if (!(++repeat_counter % 50000))
reiserfs_warning(sb, "PAP-5100",
@@ -646,29 +643,25 @@ int search_by_key(struct super_block *sb, const struct cpu_key *key, /* Key to s
have a pointer to it. */
if ((bh = last_element->pe_buffer =
sb_getblk(sb, block_number))) {
- bool unlocked = false;
- depth = REISERFS_SB(sb)->lock_depth;
- if (!buffer_uptodate(bh) && reada_count > 1)
- /* may unlock the write lock */
- unlocked = search_by_key_reada(sb, reada_bh,
- reada_blocks, reada_count);
/*
- * If we haven't already unlocked the write lock,
- * then we need to do that here before reading
- * the current block
+ * We'll need to drop the lock if we encounter any
+ * buffers that need to be read. If all of them are
+ * already up to date, we don't need to drop the lock.
*/
- if (!buffer_uptodate(bh) && !unlocked) {
- depth = reiserfs_write_unlock_nested(sb);
- unlocked = true;
- } else if (!unlocked) { /* debug */
+ int depth = -1;
+
+ if (!buffer_uptodate(bh) && reada_count > 1)
+ depth = search_by_key_reada(sb, reada_bh,
+ reada_blocks, reada_count);
+
+ if (!buffer_uptodate(bh) && depth == -1)
depth = reiserfs_write_unlock_nested(sb);
- unlocked = true;
- }
+
ll_rw_block(READ, 1, &bh);
wait_on_buffer(bh);
- if (unlocked)
+ if (depth != -1)
reiserfs_write_lock_nested(sb, depth);
if (!buffer_uptodate(bh))
goto io_error;
@@ -996,7 +989,6 @@ static char prepare_for_delete_or_cut(struct reiserfs_transaction_handle *th, st
struct super_block *sb = inode->i_sb;
struct item_head *p_le_ih = PATH_PITEM_HEAD(path);
struct buffer_head *bh = PATH_PLAST_BUFFER(path);
- int depth;
BUG_ON(!th->t_trans_id);
@@ -1065,11 +1057,7 @@ static char prepare_for_delete_or_cut(struct reiserfs_transaction_handle *th, st
reiserfs_free_block(th, inode, block, 1);
}
- if (need_resched()) {
- depth = reiserfs_write_unlock_nested(sb);
- cond_resched();
- reiserfs_write_lock_nested(sb, depth);
- }
+ reiserfs_cond_resched(sb);
if (item_moved (&s_ih, path)) {
need_re_search = 1;
@@ -1308,9 +1296,9 @@ int reiserfs_delete_item(struct reiserfs_transaction_handle *th,
"reiserquota delete_item(): freeing %u, id=%u type=%c",
quota_cut_bytes, inode->i_uid, head2type(&s_ih));
#endif
- depth = reiserfs_write_unlock_nested(sb);
+ depth = reiserfs_write_unlock_nested(inode->i_sb);
dquot_free_space_nodirty(inode, quota_cut_bytes);
- reiserfs_write_lock_nested(sb, depth);
+ reiserfs_write_lock_nested(inode->i_sb, depth);
/* Return deleted body length */
return ret_value;
@@ -1336,6 +1324,7 @@ int reiserfs_delete_item(struct reiserfs_transaction_handle *th,
void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th,
struct inode *inode, struct reiserfs_key *key)
{
+ struct super_block *sb = th->t_super;
struct tree_balance tb;
INITIALIZE_PATH(path);
int item_len = 0;
@@ -1343,7 +1332,6 @@ void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th,
struct cpu_key cpu_key;
int retval;
int quota_cut_bytes = 0;
- struct super_block *sb = th->t_super;
BUG_ON(!th->t_trans_id);
@@ -1971,6 +1959,7 @@ int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th, struct tree
const char *body, /* Pointer to the bytes to paste. */
int pasted_size)
{ /* Size of pasted bytes. */
+ struct super_block *sb = inode->i_sb;
struct tree_balance s_paste_balance;
int retval;
int fs_gen;
@@ -1987,9 +1976,9 @@ int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th, struct tree
key2type(&(key->on_disk_key)));
#endif
- depth = reiserfs_write_unlock_nested(inode->i_sb);
+ depth = reiserfs_write_unlock_nested(sb);
retval = dquot_alloc_space_nodirty(inode, pasted_size);
- reiserfs_write_lock_nested(inode->i_sb, depth);
+ reiserfs_write_lock_nested(sb, depth);
if (retval) {
pathrelse(search_path);
return retval;
@@ -2046,9 +2035,9 @@ int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th, struct tree
pasted_size, inode->i_uid,
key2type(&(key->on_disk_key)));
#endif
- depth = reiserfs_write_unlock_nested(inode->i_sb);
+ depth = reiserfs_write_unlock_nested(sb);
dquot_free_space_nodirty(inode, pasted_size);
- reiserfs_write_lock_nested(inode->i_sb, depth);
+ reiserfs_write_lock_nested(sb, depth);
return retval;
}
@@ -2063,16 +2052,15 @@ int reiserfs_insert_item(struct reiserfs_transaction_handle *th,
struct item_head *ih, struct inode *inode,
const char *body)
{
- struct super_block *sb = th->t_super;
struct tree_balance s_ins_balance;
int retval;
int fs_gen = 0;
int quota_bytes = 0;
- int depth;
BUG_ON(!th->t_trans_id);
if (inode) { /* Do we count quotas for item? */
+ int depth;
fs_gen = get_generation(inode->i_sb);
quota_bytes = ih_item_len(ih);
@@ -2088,9 +2076,9 @@ int reiserfs_insert_item(struct reiserfs_transaction_handle *th,
#endif
/* We can't dirty inode here. It would be immediately written but
* appropriate stat item isn't inserted yet... */
- depth = reiserfs_write_unlock_nested(sb);
+ depth = reiserfs_write_unlock_nested(inode->i_sb);
retval = dquot_alloc_space_nodirty(inode, quota_bytes);
- reiserfs_write_lock_nested(sb, depth);
+ reiserfs_write_lock_nested(inode->i_sb, depth);
if (retval) {
pathrelse(path);
return retval;
@@ -2142,9 +2130,9 @@ int reiserfs_insert_item(struct reiserfs_transaction_handle *th,
quota_bytes, inode->i_uid, head2type(ih));
#endif
if (inode) {
- depth = reiserfs_write_unlock_nested(sb);
+ int depth = reiserfs_write_unlock_nested(inode->i_sb);
dquot_free_space_nodirty(inode, quota_bytes);
- reiserfs_write_lock_nested(sb, depth);
+ reiserfs_write_lock_nested(inode->i_sb, depth);
}
return retval;
}
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index ae894c506d5d..3ead145dadc4 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -198,7 +198,6 @@ static int finish_unfinished(struct super_block *s)
int done;
struct inode *inode;
int truncate;
- int depth;
#ifdef CONFIG_QUOTA
int i;
int ms_active_set;
@@ -244,6 +243,7 @@ static int finish_unfinished(struct super_block *s)
done = 0;
REISERFS_SB(s)->s_is_unlinked_ok = 1;
while (!retval) {
+ int depth;
retval = search_item(s, &max_cpu_key, &path);
if (retval != ITEM_NOT_FOUND) {
reiserfs_error(s, "vs-2140",
@@ -2099,7 +2099,8 @@ static int reiserfs_statfs(struct dentry *dentry, struct kstatfs *buf)
static int reiserfs_write_dquot(struct dquot *dquot)
{
struct reiserfs_transaction_handle th;
- int ret, err, depth;
+ int ret, err;
+ int depth;
reiserfs_write_lock(dquot->dq_sb);
ret =
@@ -2123,7 +2124,8 @@ out:
static int reiserfs_acquire_dquot(struct dquot *dquot)
{
struct reiserfs_transaction_handle th;
- int ret, err, depth;
+ int ret, err;
+ int depth;
reiserfs_write_lock(dquot->dq_sb);
ret =
@@ -2147,21 +2149,20 @@ out:
static int reiserfs_release_dquot(struct dquot *dquot)
{
struct reiserfs_transaction_handle th;
- int ret, err, depth;
+ int ret, err;
reiserfs_write_lock(dquot->dq_sb);
ret =
journal_begin(&th, dquot->dq_sb,
REISERFS_QUOTA_DEL_BLOCKS(dquot->dq_sb));
- depth = reiserfs_write_unlock_nested(dquot->dq_sb);
+ reiserfs_write_unlock(dquot->dq_sb);
if (ret) {
/* Release dquot anyway to avoid endless cycle in dqput() */
dquot_release(dquot);
- reiserfs_write_lock_nested(dquot->dq_sb, depth);
goto out;
}
ret = dquot_release(dquot);
- reiserfs_write_lock_nested(dquot->dq_sb, depth);
+ reiserfs_write_lock(dquot->dq_sb);
err =
journal_end(&th, dquot->dq_sb,
REISERFS_QUOTA_DEL_BLOCKS(dquot->dq_sb));
@@ -2186,7 +2187,8 @@ 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, err, depth;
+ int ret, err;
+ int depth;
/* Data block + inode block */
reiserfs_write_lock(sb);
@@ -2209,14 +2211,8 @@ out:
*/
static int reiserfs_quota_on_mount(struct super_block *sb, int type)
{
- int ret, depth;
-
- depth = reiserfs_write_unlock_nested(sb);
- ret = dquot_quota_on_mount(sb, REISERFS_SB(sb)->s_qf_names[type],
- REISERFS_SB(sb)->s_jquota_fmt, type);
- reiserfs_write_lock_nested(sb, depth);
-
- return ret;
+ return dquot_quota_on_mount(sb, REISERFS_SB(sb)->s_qf_names[type],
+ REISERFS_SB(sb)->s_jquota_fmt, type);
}
/*