From: Greg Kroah-Hartman Date: Wed, 6 Dec 2017 16:35:59 +0000 (+0100) Subject: 4.4-stable patches X-Git-Tag: v3.18.87~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=12d81c76c692ca7c9e0da0d93affe600d07b8685;p=thirdparty%2Fkernel%2Fstable-queue.git 4.4-stable patches added patches: revert-ocfs2-should-wait-dio-before-inode-lock-in-ocfs2_setattr.patch --- diff --git a/queue-4.4/revert-ocfs2-should-wait-dio-before-inode-lock-in-ocfs2_setattr.patch b/queue-4.4/revert-ocfs2-should-wait-dio-before-inode-lock-in-ocfs2_setattr.patch new file mode 100644 index 00000000000..05d0097f7af --- /dev/null +++ b/queue-4.4/revert-ocfs2-should-wait-dio-before-inode-lock-in-ocfs2_setattr.patch @@ -0,0 +1,71 @@ +From 02b359b1331a9fd96f43028cee5500dfac4454b9 Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Wed, 6 Dec 2017 17:33:18 +0100 +Subject: Revert "ocfs2: should wait dio before inode lock in ocfs2_setattr()" + +From: Greg Kroah-Hartman + +This reverts commit c4baa4a5870cb02f713def1620052bfca7a82bbb which is +commit 28f5a8a7c033cbf3e32277f4cc9c6afd74f05300 upstream. + +It shouldn't be applied to the 4.4-stable tree. + +Ben and Alex write: + +> Now that ocfs2_setattr() calls this outside of the inode locked region, +> what prevents another task adding a new dio request immediately +> afterward? +> + +In the kernel 4.6, firstly, we use the inode_lock() in do_truncate() to +prevent another bio to be issued from this node. +Furthermore, we use the ocfs2_rw_lock() and ocfs2_inode_lock() in ocfs2_setattr() +to guarantee no more bio will be issued from the other nodes in this cluster. + +> Also, ocfs2_dio_end_io_write() was introduced in 4.6 and it looks like +> the dio completion path didn't previously take the inode lock. So it +> doesn't look this fix is needed in 3.18 or 4.4. + +Yes, ocfs2_dio_end_io_write() was introduced in 4.6 and the problem this patch +fixes is only exist in the kernel 4.6 and above 4.6. + +Reported-by: Ben Hutchings +Cc: Alex Chen +Cc: Jun Piao +Cc: Joseph Qi +Cc: Changwei Ge +Cc: Mark Fasheh +Cc: Joel Becker +Cc: Junxiao Bi +Cc: Andrew Morton +Cc: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman +--- + fs/ocfs2/file.c | 9 ++------- + 1 file changed, 2 insertions(+), 7 deletions(-) + +--- a/fs/ocfs2/file.c ++++ b/fs/ocfs2/file.c +@@ -1166,13 +1166,6 @@ int ocfs2_setattr(struct dentry *dentry, + } + size_change = S_ISREG(inode->i_mode) && attr->ia_valid & ATTR_SIZE; + if (size_change) { +- /* +- * Here we should wait dio to finish before inode lock +- * to avoid a deadlock between ocfs2_setattr() and +- * ocfs2_dio_end_io_write() +- */ +- inode_dio_wait(inode); +- + status = ocfs2_rw_lock(inode, 1); + if (status < 0) { + mlog_errno(status); +@@ -1193,6 +1186,8 @@ int ocfs2_setattr(struct dentry *dentry, + if (status) + goto bail_unlock; + ++ inode_dio_wait(inode); ++ + if (i_size_read(inode) >= attr->ia_size) { + if (ocfs2_should_order_data(inode)) { + status = ocfs2_begin_ordered_truncate(inode, diff --git a/queue-4.4/series b/queue-4.4/series index 104d26aad1d..e66370ac6d0 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -37,3 +37,4 @@ tcp-correct-memory-barrier-usage-in-tcp_check_space.patch mm-avoid-returning-vm_fault_retry-from-page_mkwrite-handlers.patch xen-netfront-improve-error-handling-during-initialization.patch net-fec-fix-multicast-filtering-hardware-setup.patch +revert-ocfs2-should-wait-dio-before-inode-lock-in-ocfs2_setattr.patch