From: Wengang Wang Date: Tue, 29 Jan 2019 03:21:20 +0000 (-0800) Subject: Revert "xfs: remove nonblocking mode from xfs_vm_writepage" X-Git-Tag: v4.1.12-124.31.3~308 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=71886fff42bcb86132f0a9d267be555004523fc7;p=users%2Fjedix%2Flinux-maple.git Revert "xfs: remove nonblocking mode from xfs_vm_writepage" This reverts commit 6e2de7d4578d4f6ae76979286de5c5ee8e91754a. These commits are very possibly to cause SIGBUS issue. (We can't verify that in customer's environment). Revert them. Orabug: 29279692 Signed-off-by: Wengang Wang Reviewed-by: Shan Hai Signed-off-by: Brian Maly --- diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 75edf5846f32..37e855c1342f 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@ -287,7 +287,8 @@ xfs_map_blocks( struct inode *inode, loff_t offset, struct xfs_bmbt_irec *imap, - int type) + int type, + int nonblocking) { struct xfs_inode *ip = XFS_I(inode); struct xfs_mount *mp = ip->i_mount; @@ -303,7 +304,12 @@ xfs_map_blocks( if (type == XFS_IO_UNWRITTEN) bmapi_flags |= XFS_BMAPI_IGSTATE; - xfs_ilock(ip, XFS_ILOCK_SHARED); + if (!xfs_ilock_nowait(ip, XFS_ILOCK_SHARED)) { + if (nonblocking) + return -EAGAIN; + xfs_ilock(ip, XFS_ILOCK_SHARED); + } + ASSERT(ip->i_d.di_format != XFS_DINODE_FMT_BTREE || (ip->i_df.if_flags & XFS_IFEXTENTS)); ASSERT(offset <= mp->m_super->s_maxbytes); @@ -955,6 +961,7 @@ xfs_vm_writepage( ssize_t len; int err, imap_valid = 0, uptodate = 1; int count = 0; + int nonblocking = 0; trace_xfs_writepage(inode, page, 0, 0); @@ -1054,6 +1061,9 @@ xfs_vm_writepage( offset = page_offset(page); type = XFS_IO_OVERWRITE; + if (wbc->sync_mode == WB_SYNC_NONE) + nonblocking = 1; + do { int new_ioend = 0; @@ -1113,7 +1123,8 @@ xfs_vm_writepage( * time. */ new_ioend = 1; - err = xfs_map_blocks(inode, offset, &imap, type); + err = xfs_map_blocks(inode, offset, &imap, type, + nonblocking); if (err) goto error; imap_valid = xfs_imap_valid(inode, &imap, offset); @@ -1183,6 +1194,9 @@ error: if (iohead) xfs_cancel_ioend(iohead); + if (err == -EAGAIN) + goto redirty; + xfs_aops_discard_page(page); ClearPageUptodate(page); unlock_page(page);