From: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
To: linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Subject: [PATCH 6/8] nilfs2: fix wrong accounting and duplicate brelse in nilfs_sufile_set_error
Date: Fri, 10 Apr 2009 14:27:59 +0900 [thread overview]
Message-ID: <1239341281-20249-7-git-send-email-konishi.ryusuke@lab.ntt.co.jp> (raw)
In-Reply-To: <1239341281-20249-1-git-send-email-konishi.ryusuke@lab.ntt.co.jp>
The nilfs_sufile_set_error() function wrongly adjusts the number of
dirty segments instead of the number of clean segments. In addition,
the function calls brelse() twice for the same buffer head.
This fixes these bugs.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
---
fs/nilfs2/sufile.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/fs/nilfs2/sufile.c b/fs/nilfs2/sufile.c
index 1ef2b4d..8b2f93c 100644
--- a/fs/nilfs2/sufile.c
+++ b/fs/nilfs2/sufile.c
@@ -523,7 +523,7 @@ int nilfs_sufile_set_error(struct inode *sufile, __u64 segnum)
struct nilfs_segment_usage *su;
struct nilfs_sufile_header *header;
void *kaddr;
- int ret;
+ int suclean, ret;
if (unlikely(segnum >= nilfs_sufile_get_nsegments(sufile))) {
printk(KERN_WARNING "%s: invalid segment number: %llu\n",
@@ -546,16 +546,19 @@ int nilfs_sufile_set_error(struct inode *sufile, __u64 segnum)
brelse(su_bh);
goto out_header;
}
+ suclean = nilfs_segment_usage_clean(su);
nilfs_segment_usage_set_error(su);
kunmap_atomic(kaddr, KM_USER0);
- brelse(su_bh);
- kaddr = kmap_atomic(header_bh->b_page, KM_USER0);
- header = nilfs_sufile_block_get_header(sufile, header_bh, kaddr);
- le64_add_cpu(&header->sh_ndirtysegs, -1);
- kunmap_atomic(kaddr, KM_USER0);
- nilfs_mdt_mark_buffer_dirty(header_bh);
+ if (suclean) {
+ kaddr = kmap_atomic(header_bh->b_page, KM_USER0);
+ header = nilfs_sufile_block_get_header(sufile, header_bh,
+ kaddr);
+ le64_add_cpu(&header->sh_ncleansegs, -1);
+ kunmap_atomic(kaddr, KM_USER0);
+ nilfs_mdt_mark_buffer_dirty(header_bh);
+ }
nilfs_mdt_mark_buffer_dirty(su_bh);
nilfs_mdt_mark_dirty(sufile);
brelse(su_bh);
--
1.5.6.5
next prev parent reply other threads:[~2009-04-10 5:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-10 5:27 [PATCH 0/8] nilfs2 updates for 2.6.30 Ryusuke Konishi
2009-04-10 5:27 ` [PATCH 1/8] nilfs2: return f_fsid for statfs2 Ryusuke Konishi
2009-04-10 6:28 ` Coly Li
2009-04-10 5:27 ` [PATCH 2/8] nilfs2: fix lockdep recursive locking warning on bmap Ryusuke Konishi
2009-04-10 5:27 ` [PATCH 3/8] nilfs2: fix lockdep recursive locking warning on meta data files Ryusuke Konishi
2009-04-10 5:27 ` [PATCH 4/8] nilfs2: remove module version Ryusuke Konishi
2009-04-10 5:27 ` [PATCH 5/8] nilfs2: simplify handling of active state of segments fix Ryusuke Konishi
2009-04-10 5:27 ` Ryusuke Konishi [this message]
2009-04-10 5:28 ` [PATCH 7/8] nilfs2: segment usage file cleanups Ryusuke Konishi
2009-04-10 5:28 ` [PATCH 8/8] nilfs2: fix possible mismatch of sufile counters on recovery Ryusuke Konishi
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=1239341281-20249-7-git-send-email-konishi.ryusuke@lab.ntt.co.jp \
--to=konishi.ryusuke@lab.ntt.co.jp \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®