From: Edward Shishkin <edward@namesys.com>
To: Andrew Morton <akpm@linux-foundation.org>, Zan Lynx <zlynx@acm.org>
Cc: ReiserFS Mailing List <reiserfs-devel@vger.kernel.org>,
Linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: [patch 3/3] reiser4: fix unix-file readpages filler
Date: Mon, 16 Jul 2007 22:51:05 +0400 [thread overview]
Message-ID: <469BBE19.5020900@namesys.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2 bytes --]
[-- Attachment #2: reiser4-fix-uf_readpages_filler.patch --]
[-- Type: text/x-patch, Size: 2000 bytes --]
Protect page (via incrementing page count) from
being reclaimed when looking for extent pointer
in unix-file specific readpages filler.
Signed-off-by: Edward Shishkin <edward@namesys.com>
---
linux-2.6.22-rc6-mm1/fs/reiser4/plugin/file/file.c | 32 +++++++++++----------
1 files changed, 18 insertions(+), 14 deletions(-)
--- linux-2.6.22-rc6-mm1/fs/reiser4/plugin/file/file.c.orig
+++ linux-2.6.22-rc6-mm1/fs/reiser4/plugin/file/file.c
@@ -1607,6 +1607,8 @@
unlock_page(page);
return 0;
}
+ page_cache_get(page);
+
if (rc->lh.node == 0) {
/* no twig lock - have to do tree search. */
reiser4_key key;
@@ -1619,21 +1621,19 @@
&key, &rc->coord, &rc->lh,
ZNODE_READ_LOCK, FIND_EXACT,
TWIG_LEVEL, TWIG_LEVEL, CBK_UNIQUE, NULL);
- if (ret)
- return ret;
+ if (unlikely(ret))
+ goto exit;
lock_page(page);
cbk_done = 1;
}
ret = zload(rc->coord.node);
- if (ret) {
- unlock_page(page);
- return ret;
- }
+ if (unlikely(ret))
+ goto unlock;
if (!coord_is_existing_item(&rc->coord) ||
!item_is_extent(&rc->coord)) {
zrelse(rc->coord.node);
- unlock_page(page);
- return RETERR(-EIO);
+ ret = RETERR(-EIO);
+ goto unlock;
}
ext = extent_by_coord(&rc->coord);
ext_index = extent_unit_index(&rc->coord);
@@ -1647,22 +1647,26 @@
/* we can be here after a CBK call only in case of
corruption of the tree or the tree lookup algorithm bug. */
if (unlikely(cbk_done)) {
- unlock_page(page);
- return RETERR(-EIO);
+ ret = RETERR(-EIO);
+ goto unlock;
}
goto repeat;
}
node = jnode_of_page(page);
if (unlikely(IS_ERR(node))) {
zrelse(rc->coord.node);
- unlock_page(page);
- return PTR_ERR(node);
+ ret = PTR_ERR(node);
+ goto unlock;
}
ret = reiser4_do_readpage_extent(ext, page->index - ext_index, page);
jput(node);
zrelse(rc->coord.node);
- if (ret)
- unlock_page(page);
+ if (likely(!ret))
+ goto exit;
+ unlock:
+ unlock_page(page);
+ exit:
+ page_cache_release(page);
return ret;
}
reply other threads:[~2007-07-16 18:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=469BBE19.5020900@namesys.com \
--to=edward@namesys.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=reiserfs-devel@vger.kernel.org \
--cc=zlynx@acm.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