From: Martin Jambor <jambormartin@gmail.com>
To: Linux FS Development List <linux-fsdevel@vger.kernel.org>
Subject: Relocking page in writepage
Date: Wed, 15 Feb 2006 16:42:25 +0100 [thread overview]
Message-ID: <9615ac9b0602150742v5b0911e2t1ee601716f4ed5dd@mail.gmail.com> (raw)
Hi,
is it ok to do something like the following in aops->writepage (or in
writepages after calling clear_page_dirty_for_io(page) for that
matter):
struct address_space mapping = page->mapping;
page_cache_get(page);
unlock_page(page);
/* do something that might deadlock if page was locked */
lock_page(page);
page_cache_release(page);
if (page->mapping != mapping) { /* truncated while doing the above */
unlock_page(page);
return 0;
}
/* continue as usual (i.e. initiate writing, set writeback
and unlock) */
A few practical tests showed no problem but I thought it would be
better to ask anyway...
I know it isn't a nice thing to do but otherwise I would probably need
to implement some mechanism to remember the page I have locked and
never try to lock (or page_cache_grab) it again. Both are cumbersome
but this is easier, what do you think about it?
Thank you very much for any insight,
Martin Jambor
next reply other threads:[~2006-02-15 15:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-15 15:42 Martin Jambor [this message]
2006-02-25 10:50 ` Relocking page in writepage Andrew Morton
2006-02-26 15:32 ` Martin Jambor
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=9615ac9b0602150742v5b0911e2t1ee601716f4ed5dd@mail.gmail.com \
--to=jambormartin@gmail.com \
--cc=linux-fsdevel@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;
as well as URLs for NNTP newsgroup(s).