From: Patrick Farrell Date: Tue, 5 Apr 2016 15:48:57 +0000 (-0500) Subject: LU-7981 llite: take trunc_sem only at vvp layer X-Git-Tag: 2.8.53~25 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=8d795c416da2e10f56b12ead8fe1b8b2b15b7dc9 LU-7981 llite: take trunc_sem only at vvp layer The lli_trunc_sem is taken in 'read' mode in both ll_page_mkwrite and vvp_io_fault_start. This can lead to a deadlock with another thread which asks for the semaphore in write mode between thse two read calls. Since all users of lli_trunc_sem are in the vvp layer, we can satisfy the requirement to exclude truncate by taking the semaphore only in vvp_io_fault_start. Signed-off-by: Patrick Farrell Change-Id: I7341d179f550835ccebfb1bb2d90260c1d5d0ff8 Reviewed-on: http://review.whamcloud.com/19315 Tested-by: Jenkins Reviewed-by: Jinshan Xiong Tested-by: Maloo Reviewed-by: Andriy Skulsyh Reviewed-by: Oleg Drokin --- diff --git a/lustre/llite/llite_mmap.c b/lustre/llite/llite_mmap.c index 7d7177c..aea44c7 100644 --- a/lustre/llite/llite_mmap.c +++ b/lustre/llite/llite_mmap.c @@ -206,17 +206,11 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage, set = cfs_block_sigsinv(sigmask(SIGKILL) | sigmask(SIGTERM)); - /* we grab lli_trunc_sem to exclude truncate case. - * Otherwise, we could add dirty pages into osc cache - * while truncate is on-going. */ inode = vvp_object_inode(io->ci_obj); lli = ll_i2info(inode); - down_read(&lli->lli_trunc_sem); result = cl_io_loop(env, io); - up_read(&lli->lli_trunc_sem); - cfs_restore_sigs(set); if (result == 0) {