diff -puN fs/reiser4/plugin/file/file.c~reiser4-tmp4 fs/reiser4/plugin/file/file.c
--- linux-2.6.12-rc2-mm3/fs/reiser4/plugin/file/file.c~reiser4-tmp4 2005-04-26 12:53:10.678341230 +0400
+++ linux-2.6.12-rc2-mm3-vs/fs/reiser4/plugin/file/file.c 2005-04-27 17:35:17.341020658 +0400
@@ -1347,6 +1347,9 @@ capture_unix_file(struct inode *inode, s
* this function is out of reiser4 context and may safely
* sleep on semaphore.
*/
+ assert("", LOCK_CNT_NIL(inode_sem_w));
+ assert("", LOCK_CNT_NIL(inode_sem_r));
+#if 0
if (is_in_reiser4_context()) {
if (down_read_trylock(&uf_info->latch) == 0) {
/* ZAM-FIXME-HANS: please explain this error handling here, grep for
@@ -1354,6 +1357,7 @@ capture_unix_file(struct inode *inode, s
* represent busy loops that we should recode. Also tell me whether
* any of them fail to return EBUSY to user space, and if yes, then
* recode them to not use the EBUSY macro.*/
+ warning("", "does this ever happen?");
result = RETERR(-EBUSY);
reiser4_exit_context(&ctx);
break;
@@ -1361,7 +1365,9 @@ capture_unix_file(struct inode *inode, s
} else
down_read(&uf_info->latch);
LOCK_CNT_INC(inode_sem_r);
-
+#endif
+ txn_restart_current();
+ get_nonexclusive_access(uf_info, 0);
while (to_capture > 0) {
pgoff_t start;
@@ -1396,8 +1402,11 @@ capture_unix_file(struct inode *inode, s
/* there may be left more pages */
redirty_inode(inode);
/* this is called with nonexclusive access obtained, file's container can not change */
static size_t
-read_file(hint_t *hint, file_container_t container,
+read_file(hint_t *hint,
struct file *file, /* file to write to */
char *buf, /* address of user-space buffer */
size_t count, /* number of bytes to write */
@@ -1652,33 +1661,6 @@ read_file(hint_t *hint, file_container_t
inode = file->f_dentry->d_inode;
- /* we have nonexclusive access (NA) obtained. File's container may not
- change until we drop NA. If possible - calculate read function
- beforehand */
- switch(container) {
- case UF_CONTAINER_EXTENTS:
- read_f = item_plugin_by_id(EXTENT_POINTER_ID)->s.file.read;
- break;
-
- case UF_CONTAINER_TAILS:
- /* this is read-ahead for tails-only files */
- result = reiser4_file_readahead(file, *off, count);
- if (result)
- return result;
-
- read_f = item_plugin_by_id(FORMATTING_ID)->s.file.read;
- break;
-
- case UF_CONTAINER_UNKNOWN:
- read_f = 0;
- break;
-
- case UF_CONTAINER_EMPTY:
- default:
- warning("vs-1297", "File (ino %llu) has unexpected state: %d\n",
- (unsigned long long)get_inode_oid(inode), container);
- return RETERR(-EIO);
- }
if (hint->ext_coord.valid)
set_hint(hint, &f->key, ZNODE_WRITE_LOCK);
@@ -480,7 +482,17 @@ tail_balance_dirty_pages(struct address_
files which are built of tails */
move_inode_out_from_sync_inodes_loop(mapping);