9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Russ Cox <rsc@swtch.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] could not write super block; waiting 10 seconds
Date: Mon, 26 Mar 2012 08:04:03 -0400	[thread overview]
Message-ID: <CADSkJJVuyHCqGzi-03588F2U8QfWn9xDpj0jC0Pqnp4cdwM-Vw@mail.gmail.com> (raw)
In-Reply-To: <374355743955e49056ab782feaec77f7@hamnavoe.com>

On Mon, Mar 26, 2012 at 6:18 AM, Richard Miller <9fans@hamnavoe.com> wrote:
> (1) When taking a snapshot, blockWrite in cache.c is called to write
> an updated super block S, which has a pointer to the root block R
> for the new epoch.  To maintain consistency on the disk, R must be
> written before S, so blockWrite checks whether R is still in the
> cache and marked dirty.  Very rarely, blockWrite finds R locked (eg
> because the flush thread is just now writing it), so it gives up and
> returns zero.  The zero return is OK when blockWrite is called by
> the flush thread, because the flush thread can get on with writing
> out other blocks before coming back to try the failed block again.
> But when blockWrite is called by superWrite, there's nothing else to
> do; hence the 10 second sleep and warning message.  The solution is
> to add a waitlock parameter to blockWrite, so superWrite can tell it
> to wait for a locked dependent block.
>
> (2) After the new super block S is sent to the disk write queue,
> superWrite removes the previous epoch's root block R' from the
> active file system.  This is normally done by attaching a BList
> entry to S in the cache, noting that R' must be marked closed after
> S actually goes to the disk.  Rarely, S has already been written by
> the time blistAlloc is called.  In this case the correct thing was
> being done (just close R' immediately), but a spurious warning was
> produced.

Than you for cleaning these up.  These are both things that
I meant to come back to some day, but I never did.

Russ


  reply	other threads:[~2012-03-26 12:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-26 10:18 Richard Miller
2012-03-26 12:04 ` Russ Cox [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-01-17 15:25 Steve Simon
2005-01-17 18:34 ` Christopher Nielsen

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=CADSkJJVuyHCqGzi-03588F2U8QfWn9xDpj0jC0Pqnp4cdwM-Vw@mail.gmail.com \
    --to=rsc@swtch.com \
    --cc=9fans@9fans.net \
    /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;
as well as URLs for NNTP newsgroup(s).