[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Max Mount Count



On Fri, 8 Jun 2001, Andreas Dilger wrote:

> Date: Fri, 8 Jun 2001 10:48:03 -0600 (MDT)
> From: Andreas Dilger <adilger turbolinux com>
> Reply-To: ext3-users redhat com
> To: ext3-users redhat com
> Subject: Re: Max Mount Count
>
> Jay writes:
> > Right.  I've the lockfs/unlockfs and journal barrier/flush in the 2.2
> > kernel in what seems to be a workable manner with desired results, other
> > than the recent issue described below (sigh).
>
> Could you send me the ext3 lockfs/unlockfs functions you are using so I can
> add them to the 2.4 CVS?  I wrote some which I _think_ are OK, but since
> you have already tested yours...

I'm using the same generic lockfs/unlockfs() wrapper code as supplied with
2.4 LVM patches for doing those bits.  I believe Andrea Arcangeli has
included them in his 2.2 tree also for use with reiserfs.

Cut&Paste below (pretty small):

void ext3_write_super_lockfs (struct super_block * sb)
{
        struct ext3_super_block * es;
        journal_t * journal;

        es = sb->u.ext3_sb.s_es;
        journal = EXT3_SB(sb)->s_journal;

        if (!(sb->s_flags & MS_RDONLY)) {
                /* Now we setup the journal barrier. */
                journal_lock_updates(journal);
                journal_flush(journal);

                /* Journal blocked and flushed, clear needs_recovery flag.
*/
                if (EXT3_HAS_INCOMPAT_FEATURE(sb,
EXT3_FEATURE_INCOMPAT_RECOVER)) {
                        EXT3_CLEAR_INCOMPAT_FEATURE(sb,
                            EXT3_FEATURE_INCOMPAT_RECOVER);
                        sb->s_dirt = 0;
                        ext3_commit_super(sb, es, 1);
                }
        }
}

void ext3_unlockfs (struct super_block * sb)
{
        struct ext3_super_block * es;
        journal_t * journal;

        es = sb->u.ext3_sb.s_es;
        journal = EXT3_SB(sb)->s_journal;

        if (!(sb->s_flags & MS_RDONLY)) {
                /* Reset the needs_recovery flag before the fs is
unlocked. */
                if (!EXT3_HAS_INCOMPAT_FEATURE(sb,
EXT3_FEATURE_INCOMPAT_RECOVER)) {
                        EXT3_SET_INCOMPAT_FEATURE(sb,
                            EXT3_FEATURE_INCOMPAT_RECOVER);
                        ext3_commit_super(sb, es, 1);
                }
                journal_unlock_updates(journal);
        }
}


> > And still no word back from LVM team on the invalidate_buffers()
> > 'feature' LVM is prone to exhibit. :)
>
> While LVM is strange for calling invalidate_buffers() on busy devices (even
> non-LVM ones), I think the fix is needed on the ext3 side.  We should just
> refuse to flush buffers that are in-use by the journal.  Finding the right
> incantations for figuring out which buffers are in use by the journal is
> another issue...

Yeah, I'm using the following which AFAIK seems to cover the occurances
that LVM surfaced.  I can run multiple pvscans, etc for hours without
generating the refile buffers at least.

+++ kernel.ext3/linux/fs/buffer.c       Thu May 17 00:24:37 2001
@@ -669,9 +669,34 @@
                                slept = 1;
                                __wait_on_buffer(bh);
                        }
-                       if (!bh->b_count &&
-                           (destroy_dirty_buffers || !buffer_dirty(bh)))
+                       /* Note: <jweber valinux com>
+                        * bh->b_jlist and !bh->b_cp_transaction
+                        * checks added to alleviate an ext3 checkpoint
+                        * transaction from being refiled when it's not
+                        * truely free.
+                        * This only occurs when somebody is doing things
+                        * to an ext3 device that they shouldn't be doing
+                        * to start with (ahem, LVM)! :)
+                        */
+                       if (!bh->b_count && bh->b_jlist == BJ_None &&
+                           !bh->b_cp_transaction &&
+                           (destroy_dirty_buffers || !buffer_dirty(bh)))
{
+                               /* Extra paranoid mode enabled!
+                                * We really want to know if there is an
+                                * ext3 transaction associated with any
buffers
+                                * that about to be refiled.  It is ext3's
job
:
+                                * to handle such buffers.  Generic fs
code
+                                * shouldn't encounter it and is unaware
of
+                                * it.
+                                */
+                               if (bh->b_transaction ||
bh->b_next_transaction
+                                   || bh->b_cp_transaction) {
+                                       printk("Ouch!  Somebody call a
doctor!\n");
+                                       goto out;
+                               }
                                put_last_free(bh);
+                       }
+out:
                        if (slept)
                                goto again;
                }


>
> Cheers, Andreas
> --
> Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
>                  \  would they cancel out, leaving him still hungry?"
> http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert
>
>
>
> _______________________________________________
> Ext3-users mailing list
> Ext3-users redhat com
> https://listman.redhat.com/mailman/listinfo/ext3-users
>





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]