From: Nikita Danilov <Nikita@Namesys.COM>
To: Andrew Morton <akpm@digeo.com>
Cc: Linux Kernel Mailing List <Linux-Kernel@Vger.Kernel.ORG>,
Alexander Viro <viro@math.psu.edu>
Subject: Re: locking rules for ->dirty_inode()
Date: Fri, 20 Sep 2002 20:32:55 +0400 [thread overview]
Message-ID: <15755.19895.544309.44729@laputa.namesys.com> (raw)
In-Reply-To: <3D8B4421.59392B30@digeo.com>
Andrew Morton writes:
> Nikita Danilov wrote:
> >
> > Hello,
> >
> > Documentation/filesystems/Locking states that all super operations may
> > block, but __set_page_dirty_buffers() calls
> >
> > __mark_inode_dirty()->s_op->dirty_inode()
> >
> > under mapping->private_lock spin lock. This seems strange, because file
> > systems' ->dirty_inode() assume that they are allowed to block. For
> > example, ext3_dirty_inode() allocates memory in
> >
> > ext3_journal_start()->journal_start()->new_handle()->...
> >
>
> OK, thanks.
>
> mapping->private_lock is taken there to pin page->buffers()
> (Can't lock the page because set_page_dirty is called under
> page_table_lock, and other locks).
>
> I'm sure we can just move the spin_unlock up to above the
> TestSetPageDirty(), but I need to zenuflect for a while over
> why I did it that way.
>
> It's necessary to expose buffer-dirtiness and page-dirtiness
> to the rest of the world in the correct order. If we set the
> page dirty and then the buffers, there is a window in which writeback
> could find the dirty page, try to write it, discover clean buffers
> and mark the page clean. We would end up with a !PageDirty page,
> on mapping->clean_pages, with dirty buffers. It would never be
> written.
>
> Yup. We can move that spin_unlock up ten lines.
Actually, I came over this while trying to describe lock ordering in
reiser4 after I just started integrating other kernel locks there. I
wonder, has somebody already done this, writing up kernel lock
hierarchy, that is?
Nikita.
next prev parent reply other threads:[~2002-09-20 16:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-20 15:00 locking rules for ->dirty_inode() Nikita Danilov
2002-09-20 15:52 ` Andrew Morton
2002-09-20 16:32 ` Nikita Danilov [this message]
2002-09-20 16:47 ` Andrew Morton
2002-09-20 17:32 ` Nikita Danilov
2002-09-20 18:21 ` Hans Reiser
2002-09-20 22:41 ` Andrew Morton
2002-09-23 16:32 ` Nikita Danilov
2002-09-23 16:42 ` 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=15755.19895.544309.44729@laputa.namesys.com \
--to=nikita@namesys.com \
--cc=Linux-Kernel@Vger.Kernel.ORG \
--cc=akpm@digeo.com \
--cc=viro@math.psu.edu \
/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