All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zach Brown <zab@zabbo.net>
To: Bryan Henderson <hbryan@us.ibm.com>
Cc: Nikita Danilov <nikita@clusterfs.com>, linux-fsdevel@vger.kernel.org
Subject: Re: Address space operations questions
Date: Thu, 31 Mar 2005 12:43:30 -0800	[thread overview]
Message-ID: <424C60F2.10707@zabbo.net> (raw)
In-Reply-To: <OFF2CCFA67.2377D356-ON88256FD5.006D49E8-88256FD5.006DB19E@us.ibm.com>

Bryan Henderson wrote:
>>So, semantics of ->sync_page() are roughly "kick underlying storage
>>driver to actually perform all IO queued for this page, and, maybe, for
>>other pages on this device too".
> 
> 
> I prefer to think of it in a more modular sense.  To preserve modularity, 
> the caller of sync_page() can't know anything about I/O scheduling.  So I 
> think the semantics of ->sync_page() are "Someone is about to wait for the 
> results of the previously requested write_page on this page."  It's 
> completely up to the owner of the address space to figure out what would 
> be appropriate to do given that information.

Though I agree with your desire for a "modular" interpretation, I'm
going disagree your description of the information sync_page() provides.
 Nikita's vague description is closer to the truth because sync_page()
is vague.

If you follow the callers of sync_page() you quickly find that what it
*really* means to be called in sync_page() is that you're being told
that some process is about to block on that page.  For what reason, you
can't know from the call alone.  Waiting for read to complete and
unlock?  Waiting for writeback to clear the writeback bit?  Some
processes just happened to race to lock_page() on the same page for
reasons that have nothing to do with IO?

And the not-so-initiated might think that sync_page() is called with the
page lock just like the other ops.  That's obviously not the case, as it
is called when the page lock can't be acquired, but it makes actually
*doing* something with that page argument perilous.  Synchronization is
left to the sync_page() callee.

For example, cachefs seems to be among the very few who don't provide
block_sync_page() directly.  All it does is printk() and then call
block_sync_page().  In that single line of code it derefs page->mapping
without checking and so can probably fatally race with truncation and
the nulling of page->mapping.

- z

  reply	other threads:[~2005-03-31 20:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <8e70aacf05032616151c958eed@mail.gmail.com>
2005-03-29 22:30 ` Address space operations questions Martin Jambor
2005-03-30 13:55   ` Nikita Danilov
2005-03-31 19:59     ` Bryan Henderson
2005-03-31 20:43       ` Zach Brown [this message]
2005-03-31 21:40         ` Bryan Henderson
2005-03-31 21:53           ` Trond Myklebust
2005-04-01  0:06             ` Bryan Henderson
2005-04-06 23:52     ` Martin Jambor
2005-04-07  8:23       ` Nikita Danilov
2005-04-17 20:21         ` Lilo requirements (Was: Re: Address space operations questions) Martin Jambor
2005-04-17 21:33           ` Nikita Danilov
2005-04-18 17:33             ` Bryan Henderson
2005-04-07 16:58       ` Address space operations - >bmap Bryan Henderson

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=424C60F2.10707@zabbo.net \
    --to=zab@zabbo.net \
    --cc=hbryan@us.ibm.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=nikita@clusterfs.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.