All of lore.kernel.org
 help / color / mirror / Atom feed
From: <gregkh@linuxfoundation.org>
To: gregkh@linuxfoundation.org, akpm@linux-foundation.org,
	alex.chen@huawei.com, ben.hutchings@codethink.co.uk,
	ge.changwei@h3c.com, jiangqi903@gmail.com, jlbec@evilplan.org,
	junxiao.bi@oracle.com, mfasheh@versity.com, piaojun@huawei.com,
	torvalds@linux-foundation.org
Cc: <stable@vger.kernel.org>, <stable-commits@vger.kernel.org>
Subject: Patch "Revert "ocfs2: should wait dio before inode lock in ocfs2_setattr()"" has been added to the 4.4-stable tree
Date: Wed, 06 Dec 2017 17:36:00 +0100	[thread overview]
Message-ID: <15125781604071@kroah.com> (raw)


This is a note to let you know that I've just added the patch titled

    Revert "ocfs2: should wait dio before inode lock in ocfs2_setattr()"

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     revert-ocfs2-should-wait-dio-before-inode-lock-in-ocfs2_setattr.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From 02b359b1331a9fd96f43028cee5500dfac4454b9 Mon Sep 17 00:00:00 2001
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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 <gregkh@linuxfoundation.org>

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 <ben.hutchings@codethink.co.uk>
Cc: Alex Chen <alex.chen@huawei.com>
Cc: Jun Piao <piaojun@huawei.com>
Cc: Joseph Qi <jiangqi903@gmail.com>
Cc: Changwei Ge <ge.changwei@h3c.com>
Cc: Mark Fasheh <mfasheh@versity.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 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,


Patches currently in stable-queue which might be from gregkh@linuxfoundation.org are

queue-4.4/xen-netfront-improve-error-handling-during-initialization.patch
queue-4.4/net-systemport-pad-packet-before-inserting-tsb.patch
queue-4.4/kvm-arm-arm64-fix-occasional-warning-from-the-timer-work-function.patch
queue-4.4/s390-pci-do-not-require-ais-facility.patch
queue-4.4/ima-fix-hash-algorithm-initialization.patch
queue-4.4/usb-phy-tahvo-fix-error-handling-in-tahvo_usb_probe.patch
queue-4.4/spi-sh-msiof-fix-dma-transfer-size-check.patch
queue-4.4/usb-dwc2-error-out-of-dwc2_hsotg_ep_disable-if-we-re-in-host-mode.patch
queue-4.4/net-appletalk-fix-kernel-memory-disclosure.patch
queue-4.4/selftests-x86-ldt_get-add-a-few-additional-tests-for-limits.patch
queue-4.4/nfsv4-fix-client-recovery-when-server-reboots-multiple-times.patch
queue-4.4/tipc-fix-cleanup-at-module-unload.patch
queue-4.4/bcache-only-permit-to-recovery-read-error-when-cache-device-is-clean.patch
queue-4.4/ravb-remove-rx-overflow-log-messages.patch
queue-4.4/usb-quirks-add-no-lpm-quirk-for-ky-688-usb-3.1-type-c-hub.patch
queue-4.4/nfs-don-t-take-a-reference-on-fl-fl_file-for-lock-operation.patch
queue-4.4/serial-8250-preserve-dld-for-port_xr17v35x.patch
queue-4.4/arm-omap1-dma-correct-the-number-of-logical-channels.patch
queue-4.4/usb-dwc2-fix-udc-state-tracking.patch
queue-4.4/mm-avoid-returning-vm_fault_retry-from-page_mkwrite-handlers.patch
queue-4.4/dmaengine-pl330-fix-double-lock.patch
queue-4.4/revert-ocfs2-should-wait-dio-before-inode-lock-in-ocfs2_setattr.patch
queue-4.4/bcache-recover-data-from-backing-when-data-is-clean.patch
queue-4.4/perf-test-attr-fix-ignored-test-case-result.patch
queue-4.4/s390-runtime-instrumentation-simplify-task-exit-handling.patch
queue-4.4/serial-8250_fintek-fix-rs485-disablement-on-invalid-ioctl.patch
queue-4.4/net-systemport-utilize-skb_put_padto.patch
queue-4.4/usbip-tools-install-all-headers-needed-for-libusbip-development.patch
queue-4.4/serial-8250_pci-add-amazon-pci-serial-device-id.patch
queue-4.4/sysrq-fix-show-regs-call-trace-on-arm.patch
queue-4.4/tcp-correct-memory-barrier-usage-in-tcp_check_space.patch
queue-4.4/net-fec-fix-multicast-filtering-hardware-setup.patch
queue-4.4/x86-entry-use-syscall_define-macros-for-sys_modify_ldt.patch
queue-4.4/uas-always-apply-us_fl_no_ata_1x-quirk-to-seagate-devices.patch
queue-4.4/vti6-fix-device-register-to-report-ifla_info_kind.patch
queue-4.4/kprobes-x86-disable-preemption-in-ftrace-based-jprobes.patch
queue-4.4/usb-serial-option-add-quectel-bg96-id.patch
queue-4.4/drm-exynos-decon5433-set-standalone_update_f-on-output-enablement.patch
queue-4.4/edac-sb_edac-fix-missing-break-in-switch.patch
queue-4.4/net-sctp-fix-array-overrun-read-on-sctp_timer_tbl.patch

                 reply	other threads:[~2017-12-06 16:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15125781604071@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=alex.chen@huawei.com \
    --cc=ben.hutchings@codethink.co.uk \
    --cc=ge.changwei@h3c.com \
    --cc=jiangqi903@gmail.com \
    --cc=jlbec@evilplan.org \
    --cc=junxiao.bi@oracle.com \
    --cc=mfasheh@versity.com \
    --cc=piaojun@huawei.com \
    --cc=stable-commits@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.