From: Andreas Dilger <adilger@clusterfs.com>
To: CaT <cat@zip.com.au>
Cc: linux-kernel@vger.kernel.org
Subject: Re: ext3 weirdness
Date: Fri, 11 Apr 2003 11:39:41 -0600 [thread overview]
Message-ID: <20030411113941.O26054@schatzie.adilger.int> (raw)
In-Reply-To: <20030411170655.GA10449@zip.com.au>; from cat@zip.com.au on Sat, Apr 12, 2003 at 03:06:56AM +1000
On Apr 12, 2003 03:06 +1000, CaT wrote:
> Why would this:
>
> while true; do dd if=/dev/zero of=foo count=100 bs=10000; rm foo; done
>
> Produce the following result?
>
> ...
> 100+0 records in
> 100+0 records out
> 100+0 records in
> 100+0 records out
> dd: writing `foo': No space left on device
> 70+0 records in
> 69+0 records out
> dd: writing `foo': No space left on device
> 1+0 records in
> 0+0 records out
:
> dd: writing `foo': No space left on device
> 1+0 records in
> 0+0 records out
> 100+0 records in
> 100+0 records out
> 100+0 records in
> 100+0 records out
> ...
Because you can't reallocate in-use blocks until the dirty bitmaps have
been committed to disk in a transaction.
What should probably happen is that in ext3_new_block() we should flush
the journal (once!) if we are going to return -ENOSPC and restart
the allocation attempt.
This may be easy (just calling journal_flush()) or it may be more effort,
depending on how the locking looks. I think journal_flush() is no good,
because by the time ext3_new_block() is called we always have a journal
handle, and I believe journal_flush() will wait for all transactions to
complete -> deadlock.
Maybe something like (just a guess):
+ int flushed = 0;
:
:
+repeat:
/*
* First, test whether the goal block is free.
*/
:
:
/* No space left on the device */
+ if (!flushed && journal->j_committing_transaction) {
+ transaction = journal->j_committing_transaction;
+ log_wait_commit(journal, transaction->t_tid);
+ flushed = 1;
+ goto repeat;
+ }
+
goto out;
search_back:
Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/
next prev parent reply other threads:[~2003-04-11 17:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-11 17:06 CaT
2003-04-11 17:39 ` Andreas Dilger [this message]
2003-04-11 22:40 ` Andrew Morton
2003-04-11 23:03 ` Andreas Dilger
2003-04-11 23:26 ` Andrew Morton
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=20030411113941.O26054@schatzie.adilger.int \
--to=adilger@clusterfs.com \
--cc=cat@zip.com.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®