From: Andrew Perepechko <anserper@ya.ru>
To: linux-ext4@vger.kernel.org
Subject: dead/wrong code in ext3/4_releasepage()
Date: Fri, 29 Jun 2012 20:52:51 +0400 [thread overview]
Message-ID: <4FEDDD63.4000800@ya.ru> (raw)
Hello!
The implementation of ext4_releasepage() for many kernel versions
(as well as current git) is the following:
static int ext4_releasepage(struct page *page, gfp_t wait)
{
journal_t *journal = EXT4_JOURNAL(page->mapping->host);
trace_ext4_releasepage(page);
WARN_ON(PageChecked(page));
if (!page_has_buffers(page))
return 0;
if (journal)
return jbd2_journal_try_to_free_buffers(journal, page,
wait);
else
return try_to_free_buffers(page);
}
The "if (!page_has_buffers(page))" check seems to be attempting to
handle the "nobh" case. However, the correct return value for this case
seems to be 1 (success), not 0 (failure).
This does not lead to oom or any similar issue since calls to
try_to_release_page()
are accompanied by page_has_private() checks.
If ->release_page() can be called without a prior check, then
the return code is wrong. Otherwise, the check is dead code.
What do you think?
Thank you,
Andrew
next reply other threads:[~2012-06-29 16:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-29 16:52 Andrew Perepechko [this message]
2012-07-02 17:09 ` dead/wrong code in ext3/4_releasepage() Jan Kara
2012-07-02 17:14 ` Andrew Perepechko
2012-07-02 17:33 ` Jan Kara
2012-07-02 18:17 ` Theodore Ts'o
2012-07-02 18:19 ` Andrew Perepechko
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=4FEDDD63.4000800@ya.ru \
--to=anserper@ya.ru \
--cc=linux-ext4@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