Commit 7e942770 authored by Frederic Weisbecker's avatar Frederic Weisbecker

kill-the-bkl/reiserfs: fix recursive reiserfs write lock in reiserfs_commit_write()

reiserfs_commit_write() is always called with the write lock held.
Thus the current calls to reiserfs_write_lock() in this function are
acquiring the lock recursively.
We can safely drop them.

This also solves further assumptions for this lock to be really
released while calling reiserfs_write_unlock().
Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Cc: Jeff Mahoney <jeffm@suse.com>
Cc: Chris Mason <chris.mason@oracle.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Alexander Beregalov <a.beregalov@gmail.com>
Cc: Laurent Riffard <laurent.riffard@free.fr>
parent b10ab4c3
...@@ -2795,7 +2795,6 @@ int reiserfs_commit_write(struct file *f, struct page *page, ...@@ -2795,7 +2795,6 @@ int reiserfs_commit_write(struct file *f, struct page *page,
*/ */
if (pos > inode->i_size) { if (pos > inode->i_size) {
struct reiserfs_transaction_handle myth; struct reiserfs_transaction_handle myth;
reiserfs_write_lock(inode->i_sb);
/* If the file have grown beyond the border where it /* If the file have grown beyond the border where it
can have a tail, unmark it as needing a tail can have a tail, unmark it as needing a tail
packing */ packing */
...@@ -2806,10 +2805,9 @@ int reiserfs_commit_write(struct file *f, struct page *page, ...@@ -2806,10 +2805,9 @@ int reiserfs_commit_write(struct file *f, struct page *page,
REISERFS_I(inode)->i_flags &= ~i_pack_on_close_mask; REISERFS_I(inode)->i_flags &= ~i_pack_on_close_mask;
ret = journal_begin(&myth, inode->i_sb, 1); ret = journal_begin(&myth, inode->i_sb, 1);
if (ret) { if (ret)
reiserfs_write_unlock(inode->i_sb);
goto journal_error; goto journal_error;
}
reiserfs_update_inode_transaction(inode); reiserfs_update_inode_transaction(inode);
inode->i_size = pos; inode->i_size = pos;
/* /*
...@@ -2821,16 +2819,13 @@ int reiserfs_commit_write(struct file *f, struct page *page, ...@@ -2821,16 +2819,13 @@ int reiserfs_commit_write(struct file *f, struct page *page,
reiserfs_update_sd(&myth, inode); reiserfs_update_sd(&myth, inode);
update_sd = 1; update_sd = 1;
ret = journal_end(&myth, inode->i_sb, 1); ret = journal_end(&myth, inode->i_sb, 1);
reiserfs_write_unlock(inode->i_sb);
if (ret) if (ret)
goto journal_error; goto journal_error;
} }
if (th) { if (th) {
reiserfs_write_lock(inode->i_sb);
if (!update_sd) if (!update_sd)
mark_inode_dirty(inode); mark_inode_dirty(inode);
ret = reiserfs_end_persistent_transaction(th); ret = reiserfs_end_persistent_transaction(th);
reiserfs_write_unlock(inode->i_sb);
if (ret) if (ret)
goto out; goto out;
} }
...@@ -2840,11 +2835,9 @@ int reiserfs_commit_write(struct file *f, struct page *page, ...@@ -2840,11 +2835,9 @@ int reiserfs_commit_write(struct file *f, struct page *page,
journal_error: journal_error:
if (th) { if (th) {
reiserfs_write_lock(inode->i_sb);
if (!update_sd) if (!update_sd)
reiserfs_update_sd(th, inode); reiserfs_update_sd(th, inode);
ret = reiserfs_end_persistent_transaction(th); ret = reiserfs_end_persistent_transaction(th);
reiserfs_write_unlock(inode->i_sb);
} }
return ret; return ret;
......
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