--- fs/ext3/inode.c~ Tue Oct 19 16:19:28 1999 +++ fs/ext3/inode.c Tue Oct 19 18:27:00 1999 @@ -724,7 +724,7 @@ struct buffer_head *bh; journal_t *journal; handle_t *handle; - int err; + int err, need_extend = 0; err = ext3_get_inode_loc(inode, &iloc); if (err) @@ -740,14 +740,42 @@ * to keep things safe. (The do_update_inode normally will * not block, so locking the journal should be acceptable for * performance, but in case it _does_ block we have to be - * ultra-cautious.) */ + * ultra-cautious.) + * + * Finally, we also need to deal with the case where we are + * already running in a transaction by the time we get here + * (ie. a filesystem transaction calls iget(), we have too many + * dirty inodes present, and the VFS starts to do a + * sync_inodes(). In this case we cannot start a new + * transaction, we just have to extend the existing one. If + * that fails, we return silently: there's nothing we can do + * without deadlocking the transaction engine. + */ journal = EXT3_JOURNAL(inode); lock_journal(journal); bh = iloc.bh; if (bh->b_transaction != NULL || bh->b_jlist != BJ_None) { + handle = current->j_handle; + + if (handle) { + if (bh->b_transaction != handle->h_transaction && + bh->b_next_transaction != handle->h_transaction) + need_extend = 1; + } + unlock_journal(journal); + + /* Is it a recursive transaction needing a new buffer + * credit? */ + if (need_extend) { + if (journal_extend(handle, 1)) { + mark_inode_dirty(inode); + return; + } + } + handle = journal_start(journal, 1); /* @@@ Error? */ ext3_mark_inode_dirty(handle, inode); journal_stop(handle); --- fs/ext3/super.c.~1~ Tue Oct 19 16:19:19 1999 +++ fs/ext3/super.c Tue Oct 19 16:47:14 1999 @@ -729,8 +729,8 @@ printk("EXT3-fs: no journal found.\n"); return NULL; } - printk("Journal inode found at %p: %ld\n", - journal_inode, journal_inode->i_size); + jfs_debug(2, "Journal inode found at %p: %ld bytes\n", + journal_inode, journal_inode->i_size); if (!journal_inode->i_nlink || !S_ISREG(journal_inode->i_mode)) { printk("EXT3-fs: invalid journal inode.\n");