Hi zam,

On Wed, Mar 15, 2006 at 11:11:49AM +0300, Alexander Zarochentsev wrote:
> Hello,
> 
> please try the attached patch.
> 
> -- 
> Alex.

> [ skipped life-saving patch ]

I just checked my currently used reiser4 version against
reiser4-for-2.6.16-1 and noticed that this patch was not in there. The
diff between my copy (2.6.16-rc4-mm2 with your patch on top) and status
quo follows:


diff -urN a/fs/reiser4/as_ops.c b/fs/reiser4/as_ops.c
--- a/fs/reiser4/as_ops.c       2006-03-20 20:11:38.000000000 +0100
+++ b/fs/reiser4/as_ops.c       2006-03-30 14:19:27.000000000 +0200
@@ -222,7 +222,7 @@
 
        ctx = init_context(inode->i_sb);
        if (IS_ERR(ctx))
-               return PTR_ERR(ctx);
+               return RETERR(PTR_ERR(ctx));
 
        node = jprivate(page);
        spin_lock_jnode(node);
diff -urN a/fs/reiser4/page_cache.c b/fs/reiser4/page_cache.c
--- a/fs/reiser4/page_cache.c   2006-03-20 20:11:38.000000000 +0100
+++ b/fs/reiser4/page_cache.c   2006-03-30 14:19:27.000000000 +0200
@@ -198,10 +198,6 @@
 {
        assert("nikita-2168", fake->i_state & I_NEW);
        fake->i_mapping->a_ops = &formatted_fake_as_ops;
-       fake->i_blkbits = super->s_blocksize_bits;
-       fake->i_size = ~0ull;
-       fake->i_rdev = super->s_bdev->bd_dev;
-       fake->i_bdev = super->s_bdev;
        *pfake = fake;
        /* NOTE-NIKITA something else? */
        unlock_new_inode(fake);
diff -urN a/fs/reiser4/plugin/file/file.c b/fs/reiser4/plugin/file/file.c
--- a/fs/reiser4/plugin/file/file.c     2006-03-20 20:11:38.000000000 +0100
+++ b/fs/reiser4/plugin/file/file.c     2006-03-30 14:19:27.000000000 +0200
@@ -1451,6 +1451,9 @@
        int result;
        unix_file_info_t *uf_info;
 
+       /* close current transaction */
+       txn_restart_current();
+
        uf_info = unix_file_inode_data(inode);
 
        /*
@@ -2171,6 +2174,7 @@
                                done_lh(&hint->lh);
                                if (!exclusive) {
                                        drop_nonexclusive_access(uf_info);
+                                       txn_restart_current();
                                        get_exclusive_access(uf_info);
                                }
                                result = tail2extent(uf_info);
@@ -2960,6 +2964,15 @@
        unix_file_info_t *uf_info;
        int result;
 
+       /*
+        * transaction can be open already. For example:
+        * writeback_inodes->sync_sb_inodes->reiser4_sync_inodes->
+        * generic_sync_sb_inodes->iput->generic_drop_inode->
+        * generic_delete_inode->reiser4_delete_inode->delete_object_unix_file.
+        * So, restart transaction to avoid deadlock with file rw semaphore.
+        */
+       txn_restart_current();
+
        if (inode_get_flag(inode, REISER4_NO_SD))
                return 0;
 
diff -urN a/fs/reiser4/plugin/file/tail_conversion.c 
b/fs/reiser4/plugin/file/tail_conversion.c
--- a/fs/reiser4/plugin/file/tail_conversion.c  2006-03-20 20:11:38.000000000 
+0100
+++ b/fs/reiser4/plugin/file/tail_conversion.c  2006-03-30 14:19:27.000000000 
+0200
@@ -20,12 +20,13 @@
        assert("nikita-3047", LOCK_CNT_NIL(inode_sem_w));
        assert("nikita-3048", LOCK_CNT_NIL(inode_sem_r));
        /*
-        * "deadlock avoidance": sometimes we commit a transaction under
+        * "deadlock detection": sometimes we commit a transaction under
         * rw-semaphore on a file. Such commit can deadlock with another
         * thread that captured some block (hence preventing atom from being
         * committed) and waits on rw-semaphore.
         */
-       txn_restart_current();
+       assert("nikita-3361", get_current_context()->trans->atom == NULL);
+       BUG_ON(get_current_context()->trans->atom != NULL);
        LOCK_CNT_INC(inode_sem_w);
        down_write(&uf_info->latch);
        uf_info->exclusive_use = 1;


This would basically revert your patch once applied to my local copy,
and make some other tiny changes. Will those take care of the problem,
or was your solution lost somehow?

The diff between reiser4-for-2.6.16-1 with your patch applied and my copy looks 
like this:


diff -urN a/fs/reiser4/as_ops.c b/fs/reiser4/as_ops.c
--- a/fs/reiser4/as_ops.c       2006-03-20 20:11:38.000000000 +0100
+++ b/fs/reiser4/as_ops.c       2006-03-30 14:19:27.000000000 +0200
@@ -222,7 +222,7 @@
 
        ctx = init_context(inode->i_sb);
        if (IS_ERR(ctx))
-               return PTR_ERR(ctx);
+               return RETERR(PTR_ERR(ctx));
 
        node = jprivate(page);
        spin_lock_jnode(node);
diff -urN a/fs/reiser4/page_cache.c b/fs/reiser4/page_cache.c
--- a/fs/reiser4/page_cache.c   2006-03-20 20:11:38.000000000 +0100
+++ b/fs/reiser4/page_cache.c   2006-03-30 14:19:27.000000000 +0200
@@ -198,10 +198,6 @@
 {
        assert("nikita-2168", fake->i_state & I_NEW);
        fake->i_mapping->a_ops = &formatted_fake_as_ops;
-       fake->i_blkbits = super->s_blocksize_bits;
-       fake->i_size = ~0ull;
-       fake->i_rdev = super->s_bdev->bd_dev;
-       fake->i_bdev = super->s_bdev;
        *pfake = fake;
        /* NOTE-NIKITA something else? */
        unlock_new_inode(fake);


Is that supposed to do the job of avoiding the trouble I had?


Kind regards,

Chris (currently wondering which codebase to test-drive the hell out
without volumes going that way)

Attachment: pgpSYgwj4RrId.pgp
Description: PGP signature

Reply via email to