diff options
author | Tristan Ye <tristan.ye@oracle.com> | 2010-12-07 01:35:07 -0500 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2010-12-09 18:36:48 -0500 |
commit | 39c99f12f15c8bf8257985d9b2a2548a03d18c00 (patch) | |
tree | 38f09ce41f6cbfd3a73b1dc66098ba3bf05e2d6a /fs/ocfs2/aops.c | |
parent | 388c4bcb4e63e88fb1f312a2f5f9eb2623afcf5b (diff) |
Ocfs2: Teach 'coherency=full' O_DIRECT writes to correctly up_read i_alloc_sem.
Due to newly-introduced 'coherency=full' O_DIRECT writes also takes the EX
rw_lock like buffered writes did(rw_level == 1), it turns out messing the
usage of 'level' in ocfs2_dio_end_io() up, which caused i_alloc_sem being
failed to get up_read'd correctly.
This patch tries to teach ocfs2_dio_end_io to understand well on all locking
stuffs by explicitly introducing a new bit for i_alloc_sem in iocb's private
data, just like what we did for rw_lock.
Signed-off-by: Tristan Ye <tristan.ye@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/aops.c')
-rw-r--r-- | fs/ocfs2/aops.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index f1e962cb3b73..0d7c5540ad66 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -573,11 +573,14 @@ static void ocfs2_dio_end_io(struct kiocb *iocb, | |||
573 | /* this io's submitter should not have unlocked this before we could */ | 573 | /* this io's submitter should not have unlocked this before we could */ |
574 | BUG_ON(!ocfs2_iocb_is_rw_locked(iocb)); | 574 | BUG_ON(!ocfs2_iocb_is_rw_locked(iocb)); |
575 | 575 | ||
576 | if (ocfs2_iocb_is_sem_locked(iocb)) { | ||
577 | up_read(&inode->i_alloc_sem); | ||
578 | ocfs2_iocb_clear_sem_locked(iocb); | ||
579 | } | ||
580 | |||
576 | ocfs2_iocb_clear_rw_locked(iocb); | 581 | ocfs2_iocb_clear_rw_locked(iocb); |
577 | 582 | ||
578 | level = ocfs2_iocb_rw_locked_level(iocb); | 583 | level = ocfs2_iocb_rw_locked_level(iocb); |
579 | if (!level) | ||
580 | up_read(&inode->i_alloc_sem); | ||
581 | ocfs2_rw_unlock(inode, level); | 584 | ocfs2_rw_unlock(inode, level); |
582 | 585 | ||
583 | if (is_async) | 586 | if (is_async) |