Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1242543

[RFC PATCH 2/2] fs: Disable interrupts after acquiring bit_spin_lock

From Nikolay Borisov <kernel@kyup.com>
Newsgroups linux.kernel
Subject [RFC PATCH 2/2] fs: Disable interrupts after acquiring bit_spin_lock
Date 2015-10-08 17:40 +0200
Message-ID <qhlsv-7EU-41@gated-at.bofh.it> (permalink)
References <qhlsv-7EU-39@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Signed-off-by: Nikolay Borisov <kernel@kyup.com>
---
 fs/buffer.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index 82283ab..7109d6a 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -305,8 +305,8 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate)
 	 * decide that the page is now completely done.
 	 */
 	first = page_buffers(page);
-	local_irq_save(flags);
 	bit_spin_lock(BH_Uptodate_Lock, &first->b_state);
+	local_irq_save(flags);
 	clear_buffer_async_read(bh);
 	unlock_buffer(bh);
 	tmp = bh;
@@ -319,8 +319,8 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate)
 		}
 		tmp = tmp->b_this_page;
 	} while (tmp != bh);
-	bit_spin_unlock(BH_Uptodate_Lock, &first->b_state);
 	local_irq_restore(flags);
+	bit_spin_unlock(BH_Uptodate_Lock, &first->b_state);
 
 	/*
 	 * If none of the buffers had errors and they are all
@@ -332,8 +332,8 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate)
 	return;
 
 still_busy:
-	bit_spin_unlock(BH_Uptodate_Lock, &first->b_state);
 	local_irq_restore(flags);
+	bit_spin_unlock(BH_Uptodate_Lock, &first->b_state);
 	return;
 }
 
@@ -362,8 +362,8 @@ void end_buffer_async_write(struct buffer_head *bh, int uptodate)
 	}
 
 	first = page_buffers(page);
-	local_irq_save(flags);
 	bit_spin_lock(BH_Uptodate_Lock, &first->b_state);
+	local_irq_save(flags);
 
 	clear_buffer_async_write(bh);
 	unlock_buffer(bh);
@@ -375,14 +375,14 @@ void end_buffer_async_write(struct buffer_head *bh, int uptodate)
 		}
 		tmp = tmp->b_this_page;
 	}
-	bit_spin_unlock(BH_Uptodate_Lock, &first->b_state);
 	local_irq_restore(flags);
+	bit_spin_unlock(BH_Uptodate_Lock, &first->b_state);
 	end_page_writeback(page);
 	return;
 
 still_busy:
-	bit_spin_unlock(BH_Uptodate_Lock, &first->b_state);
 	local_irq_restore(flags);
+	bit_spin_unlock(BH_Uptodate_Lock, &first->b_state);
 	return;
 }
 EXPORT_SYMBOL(end_buffer_async_write);
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH 1/2] ext4: Fix possible deadlock with local interrupts disabled and page-draining IPI Nikolay Borisov <kernel@kyup.com> - 2015-10-08 17:40 +0200
  [RFC PATCH 2/2] fs: Disable interrupts after acquiring bit_spin_lock Nikolay Borisov <kernel@kyup.com> - 2015-10-08 17:40 +0200
  Re: [RFC PATCH 1/2] ext4: Fix possible deadlock with local interrupts  disabled and page-draining IPI Nikolay Borisov <kernel@kyup.com> - 2015-10-09 11:00 +0200

csiph-web