All of lore.kernel.org
 help / color / mirror / Atom feed
* [Ocfs2-devel] Orphan scan fixes - V2
@ 2009-06-19 23:53 Sunil Mushran
  2009-06-19 23:53 ` [Ocfs2-devel] [PATCH 3/5] ocfs2: Stop orphan scan as early as possible during umount Sunil Mushran
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Sunil Mushran @ 2009-06-19 23:53 UTC (permalink / raw)
  To: ocfs2-devel

Implemented the suggestions.

Also, moved the ocfs2_orphan_scan_init() to the end of ocfs2_fill_super()
instead of calling it earlier in ocfs2_initialize_super().

Sunil

^ permalink raw reply	[flat|nested] 12+ messages in thread
* [Ocfs2-devel] [PATCH 1/5] ocfs2: Pin journal head before accessing jh->b_committed_data
@ 2009-06-19 21:45 Sunil Mushran
  2009-06-19 21:45 ` [Ocfs2-devel] [PATCH 4/5] ocfs2: Do not initialize lvb in ocfs2_orphan_scan_lock_res_init() Sunil Mushran
  0 siblings, 1 reply; 12+ messages in thread
From: Sunil Mushran @ 2009-06-19 21:45 UTC (permalink / raw)
  To: ocfs2-devel

This patch adds jbd_lock_bh_state() and jbd_unlock_bh_state() around accessses
to jh->b_committed_data.

Fixes oss bugzilla#1131
http://oss.oracle.com/bugzilla/show_bug.cgi?id=1131

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 fs/ocfs2/suballoc.c |   28 ++++++++++++++++++++++++----
 1 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index 8439f6b..73a16d4 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -923,14 +923,23 @@ static int ocfs2_test_bg_bit_allocatable(struct buffer_head *bg_bh,
 					 int nr)
 {
 	struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data;
+	int ret;
 
 	if (ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap))
 		return 0;
-	if (!buffer_jbd(bg_bh) || !bh2jh(bg_bh)->b_committed_data)
+
+	if (!buffer_jbd(bg_bh))
 		return 1;
 
+	jbd_lock_bh_state(bg_bh);
 	bg = (struct ocfs2_group_desc *) bh2jh(bg_bh)->b_committed_data;
-	return !ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap);
+	if (bg)
+		ret = !ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap);
+	else
+		ret = 1;
+	jbd_unlock_bh_state(bg_bh);
+
+	return ret;
 }
 
 static int ocfs2_block_group_find_clear_bits(struct ocfs2_super *osb,
@@ -1885,6 +1894,7 @@ static inline int ocfs2_block_group_clear_bits(handle_t *handle,
 	unsigned int tmp;
 	int journal_type = OCFS2_JOURNAL_ACCESS_WRITE;
 	struct ocfs2_group_desc *undo_bg = NULL;
+	int cluster_bitmap = 0;
 
 	mlog_entry_void();
 
@@ -1905,18 +1915,28 @@ static inline int ocfs2_block_group_clear_bits(handle_t *handle,
 	}
 
 	if (ocfs2_is_cluster_bitmap(alloc_inode))
-		undo_bg = (struct ocfs2_group_desc *) bh2jh(group_bh)->b_committed_data;
+		cluster_bitmap = 1;
+
+	if (cluster_bitmap) {
+		jbd_lock_bh_state(group_bh);
+		undo_bg = (struct ocfs2_group_desc *)
+					bh2jh(group_bh)->b_committed_data;
+		BUG_ON(!undo_bg);
+	}
 
 	tmp = num_bits;
 	while(tmp--) {
 		ocfs2_clear_bit((bit_off + tmp),
 				(unsigned long *) bg->bg_bitmap);
-		if (ocfs2_is_cluster_bitmap(alloc_inode))
+		if (cluster_bitmap)
 			ocfs2_set_bit(bit_off + tmp,
 				      (unsigned long *) undo_bg->bg_bitmap);
 	}
 	le16_add_cpu(&bg->bg_free_bits_count, num_bits);
 
+	if (cluster_bitmap)
+		jbd_unlock_bh_state(group_bh);
+
 	status = ocfs2_journal_dirty(handle, group_bh);
 	if (status < 0)
 		mlog_errno(status);
-- 
1.6.0.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-06-22 17:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-19 23:53 [Ocfs2-devel] Orphan scan fixes - V2 Sunil Mushran
2009-06-19 23:53 ` [Ocfs2-devel] [PATCH 3/5] ocfs2: Stop orphan scan as early as possible during umount Sunil Mushran
2009-06-20  6:04   ` Joel Becker
2009-06-19 23:53 ` [Ocfs2-devel] [PATCH 4/5] ocfs2: Do not initialize lvb in ocfs2_orphan_scan_lock_res_init() Sunil Mushran
2009-06-20  6:05   ` Joel Becker
2009-06-19 23:53 ` [Ocfs2-devel] [PATCH 5/5] ocfs2: Disable orphan scanning for local and hard-ro mounts Sunil Mushran
2009-06-20  4:41   ` Joel Becker
2009-06-20  4:57     ` Sunil Mushran
2009-06-22 16:17     ` Joel Becker
2009-06-22 17:26       ` Sunil Mushran
  -- strict thread matches above, loose matches on Subject: below --
2009-06-19 21:45 [Ocfs2-devel] [PATCH 1/5] ocfs2: Pin journal head before accessing jh->b_committed_data Sunil Mushran
2009-06-19 21:45 ` [Ocfs2-devel] [PATCH 4/5] ocfs2: Do not initialize lvb in ocfs2_orphan_scan_lock_res_init() Sunil Mushran
2009-06-19 21:59   ` Joel Becker

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.