From: Jinshan Xiong Date: Wed, 15 Feb 2017 19:16:59 +0000 (-0800) Subject: LU-9129 llite: ignore layout for ll_writepages() X-Git-Tag: 2.9.55~5 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=5236673a906aecc91993fbbf97adaf7a1feecd2b;p=fs%2Flustre-release.git LU-9129 llite: ignore layout for ll_writepages() ll_writepages() would be called inside the direct IO context and if the layout has been changed during this time, the layout_conf() has to wait for active IO to complete before applying the layout change, this is a case of deadlock. It should ignore layout to avoid this problem. This is safe as long as pages exist, the layout won't be changed on this client. Signed-off-by: Jinshan Xiong Change-Id: I457133a4a30215b8513d5eaec449fc129cc43a3e Reviewed-on: https://review.whamcloud.com/25474 Tested-by: Jenkins Reviewed-by: Bobi Jam Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index 27cb478..c8c63a5 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -987,13 +987,11 @@ out: int ll_writepages(struct address_space *mapping, struct writeback_control *wbc) { struct inode *inode = mapping->host; - struct ll_sb_info *sbi = ll_i2sbi(inode); loff_t start; loff_t end; enum cl_fsync_mode mode; int range_whole = 0; int result; - int ignore_layout = 0; ENTRY; if (wbc->range_cyclic) { @@ -1012,16 +1010,13 @@ int ll_writepages(struct address_space *mapping, struct writeback_control *wbc) if (wbc->sync_mode == WB_SYNC_ALL) mode = CL_FSYNC_LOCAL; - if (sbi->ll_umounting) - /* if the mountpoint is being umounted, all pages have to be - * evicted to avoid hitting LBUG when truncate_inode_pages() - * is called later on. */ - ignore_layout = 1; - if (ll_i2info(inode)->lli_clob == NULL) RETURN(0); - result = cl_sync_file_range(inode, start, end, mode, ignore_layout); + /* for directio, it would call writepages() to evict cached pages + * inside the IO context of write, which will cause deadlock at + * layout_conf since it waits for active IOs to complete. */ + result = cl_sync_file_range(inode, start, end, mode, 1); if (result > 0) { wbc->nr_to_write -= result; result = 0;