
From: Hans Reiser <reiser@namesys.com>

This patch fixes a breach of reiser4's deadlock preventing rules

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/fs/reiser4/plugin/file/file.c            |    2 ++
 25-akpm/fs/reiser4/plugin/file/tail_conversion.c |    2 ++
 2 files changed, 4 insertions(+)

diff -puN fs/reiser4/plugin/file/file.c~reiser4-fix-deadlock fs/reiser4/plugin/file/file.c
--- 25/fs/reiser4/plugin/file/file.c~reiser4-fix-deadlock	Fri Nov 12 16:02:10 2004
+++ 25-akpm/fs/reiser4/plugin/file/file.c	Fri Nov 12 16:02:10 2004
@@ -1774,6 +1774,7 @@ read_unix_file(struct file *file, char *
 		if (user_space)
 			reiser4_put_user_pages(pages, nr_pages);
 		drop_nonexclusive_access(uf_info);
+		txn_restart_current();
 
 		if (read < 0) {
 			result = read;
@@ -1875,6 +1876,7 @@ append_and_or_overwrite(hint_t *hint, st
 				result = tail2extent(uf_info);
 				if (!exclusive) {
 					drop_exclusive_access(uf_info);
+					txn_restart_current();
 					get_nonexclusive_access(uf_info);
 				}
 				if (result)
diff -puN fs/reiser4/plugin/file/tail_conversion.c~reiser4-fix-deadlock fs/reiser4/plugin/file/tail_conversion.c
--- 25/fs/reiser4/plugin/file/tail_conversion.c~reiser4-fix-deadlock	Fri Nov 12 16:02:10 2004
+++ 25-akpm/fs/reiser4/plugin/file/tail_conversion.c	Fri Nov 12 16:02:10 2004
@@ -54,6 +54,8 @@ reiser4_internal void
 get_nonexclusive_access(unix_file_info_t *uf_info)
 {
 	assert("nikita-3029", schedulable());
+	assert("nikita-3361", get_current_context()->trans->atom == NULL);
+	BUG_ON(get_current_context()->trans->atom != NULL);
 	down_read(&uf_info->latch);
 	LOCK_CNT_INC(inode_sem_r);
 	assert("vs-1716", uf_info->ea_owner == NULL);
_
