* + ocfs2-the-ip_alloc_sem-should-be-taken-in-ocfs2_get_block.patch added to -mm tree
@ 2017-10-31 20:58 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2017-10-31 20:58 UTC (permalink / raw)
To: alex.chen, ge.changwei, jiangqi903, jlbec, junxiao.bi, mfasheh,
piaojun, mm-commits
The patch titled
Subject: ocfs2: ip_alloc_sem should be taken in ocfs2_get_block()
has been added to the -mm tree. Its filename is
ocfs2-the-ip_alloc_sem-should-be-taken-in-ocfs2_get_block.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/ocfs2-the-ip_alloc_sem-should-be-taken-in-ocfs2_get_block.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/ocfs2-the-ip_alloc_sem-should-be-taken-in-ocfs2_get_block.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: alex chen <alex.chen@huawei.com>
Subject: ocfs2: ip_alloc_sem should be taken in ocfs2_get_block()
ip_alloc_sem should be taken in ocfs2_get_block() when reading file in
DIRECT mode to prevent concurrent access to extent tree with
ocfs2_dio_end_io_write(), which may cause BUGON in
ocfs2_get_clusters_nocache()->BUG_ON(v_cluster < le32_to_cpu(rec->e_cpos))
Link: http://lkml.kernel.org/r/59E9BBEF.1060601@huawei.com
Signed-off-by: Alex Chen <alex.chen@huawei.com>
Reviewed-by: Jun Piao <piaojun@huawei.com>
Cc: Changwei Ge <ge.changwei@h3c.com>
Cc: Mark Fasheh <mfasheh@versity.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Joseph Qi <jiangqi903@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
fs/ocfs2/aops.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff -puN fs/ocfs2/aops.c~ocfs2-the-ip_alloc_sem-should-be-taken-in-ocfs2_get_block fs/ocfs2/aops.c
--- a/fs/ocfs2/aops.c~ocfs2-the-ip_alloc_sem-should-be-taken-in-ocfs2_get_block
+++ a/fs/ocfs2/aops.c
@@ -134,6 +134,19 @@ bail:
return err;
}
+static int ocfs2_get_block_lock(struct inode *inode, sector_t iblock,
+ struct buffer_head *bh_result, int create)
+{
+ int ret;
+ struct ocfs2_inode_info *oi = OCFS2_I(inode);
+
+ down_read(&oi->ip_alloc_sem);
+ ret = ocfs2_get_block(inode, iblock, bh_result, create);
+ up_read(&oi->ip_alloc_sem);
+
+ return ret;
+}
+
int ocfs2_get_block(struct inode *inode, sector_t iblock,
struct buffer_head *bh_result, int create)
{
@@ -2154,12 +2167,8 @@ static int ocfs2_dio_get_block(struct in
* while file size will be changed.
*/
if (pos + total_len <= i_size_read(inode)) {
- down_read(&oi->ip_alloc_sem);
/* This is the fast path for re-write. */
- ret = ocfs2_get_block(inode, iblock, bh_result, create);
-
- up_read(&oi->ip_alloc_sem);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-10-31 20:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-31 20:58 + ocfs2-the-ip_alloc_sem-should-be-taken-in-ocfs2_get_block.patch added to -mm tree akpm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).