From: Andreas Dilger <adilger@clusterfs.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Andrew Morton <akpm@osdl.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [EXT3/JBD] Periodic journal flush not enough?
Date: Fri, 26 Mar 2004 16:55:11 -0700 [thread overview]
Message-ID: <20040326235511.GW1177@schnapps.adilger.int> (raw)
In-Reply-To: <20040326231958.GA484@gondor.apana.org.au>
On Mar 27, 2004 10:19 +1100, Herbert Xu wrote:
> I've encountered a problem with the journal flush timer. The problem
> is that when a filesystem is short on space, relying on a timer-based
> flushing mechanism is no longer adequate. For example, on my P4 2GHz
> I can trigger an ENOSPC error by doing
>
> while :; do echo test > a; [ -s a ] || break; rm a; done; echo Out of space
>
> on an ext3 file system with 12Mb of free space using the usual 5s
> journal flush timer.
>
> Of course, when you extend the flushing period as you do with laptop-mode,
> this problem becomes a lot worse.
>
> So would it be possible to have the flushing activated on demand?
I had created a patch a while ago, but never really got any testing on it.
It would be great to get this problem fixed. Patch against a 2.4.x kernel.
--- fs/ext3/balloc.c.orig Fri Jul 25 19:55:34 2003
+++ fs/ext3/balloc.c Tue Sep 2 16:27:51 2003
@@ -547,6 +547,8 @@ int ext3_new_block (handle_t *handle, st
#ifdef EXT3FS_DEBUG
static int goal_hits = 0, goal_attempts = 0;
#endif
+ int tried_commit = 0;
+
*errp = -ENOSPC;
sb = inode->i_sb;
if (!sb) {
@@ -643,6 +645,26 @@ repeat:
}
}
+ /* We can only try to commit the previous transaction, or we will
+ * deadlock because the current op has a transaction handle open.
+ * We also can't restart the current handle in a new transaction as
+ * that might break the atomicity guarantees of this transaction.
+ * Set current handle h_sync to allow it to be committed ASAP. */
+ if (!tried_commit) {
+ journal_t *journal = handle->h_transaction->t_journal;
+ transaction_t *prev_trans = journal->j_committing_transaction;
+
+ if (prev_trans) {
+ tid_t prev_tid = prev_trans->t_tid;
+ log_start_commit(journal, prev_trans);
+ log_wait_commit(journal, prev_tid);
+ }
+ handle->h_sync = 1;
+ tried_commit = 1;
+
+ goto repeat;
+ }
+
/* No space left on the device */
goto out;
Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/
next prev parent reply other threads:[~2004-03-26 23:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-26 23:19 Herbert Xu
2004-03-26 23:48 ` Andrew Morton
2004-03-27 0:01 ` Herbert Xu
2004-03-29 18:56 ` Stephen C. Tweedie
2004-03-29 19:16 ` Chris Mason
2004-03-26 23:55 ` Andreas Dilger [this message]
2004-03-29 20:03 ` Stephen C. Tweedie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040326235511.GW1177@schnapps.adilger.int \
--to=adilger@clusterfs.com \
--cc=akpm@osdl.org \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®