All of lore.kernel.org
 help / color / mirror / Atom feed
* + ocfs2-fix-deadlock-between-setattr-and-dio_end_io_write-v2.patch added to -mm tree
@ 2021-04-02 22:16 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2021-04-02 22:16 UTC (permalink / raw)
  To: gechangwei, ghe, jiangqi903, jlbec, junxiao.bi, mark, mm-commits,
	piaojun, wen.gang.wang


The patch titled
     Subject: ocfs2-fix-deadlock-between-setattr-and-dio_end_io_write-v2
has been added to the -mm tree.  Its filename is
     ocfs2-fix-deadlock-between-setattr-and-dio_end_io_write-v2.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/ocfs2-fix-deadlock-between-setattr-and-dio_end_io_write-v2.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/ocfs2-fix-deadlock-between-setattr-and-dio_end_io_write-v2.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Wengang Wang <wen.gang.wang@oracle.com>
Subject: ocfs2-fix-deadlock-between-setattr-and-dio_end_io_write-v2

remove the "had_alloc_lock" as suggested

Link: https://lkml.kernel.org/r/20210402171344.1605-1-wen.gang.wang@oracle.com
Cc: stable@vger.kernel.org
Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Joseph Qi <jiangqi903@gmail.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Jun Piao <piaojun@huawei.com>

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/ocfs2/file.c |   15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

--- a/fs/ocfs2/file.c~ocfs2-fix-deadlock-between-setattr-and-dio_end_io_write-v2
+++ a/fs/ocfs2/file.c
@@ -1124,7 +1124,7 @@ int ocfs2_setattr(struct user_namespace
 	handle_t *handle = NULL;
 	struct dquot *transfer_to[MAXQUOTAS] = { };
 	int qtype;
-	int had_lock, had_alloc_lock = 0;
+	int had_lock;
 	struct ocfs2_lock_holder oh;
 
 	trace_ocfs2_setattr(inode, dentry,
@@ -1246,27 +1246,23 @@ int ocfs2_setattr(struct user_namespace
 			}
 		}
 		down_write(&OCFS2_I(inode)->ip_alloc_sem);
-		had_alloc_lock = 1;
-
 		handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS +
 					   2 * ocfs2_quota_trans_credits(sb));
 		if (IS_ERR(handle)) {
 			status = PTR_ERR(handle);
 			mlog_errno(status);
-			goto bail_unlock;
+			goto bail_unlock_alloc;
 		}
 		status = __dquot_transfer(inode, transfer_to);
 		if (status < 0)
 			goto bail_commit;
 	} else {
 		down_write(&OCFS2_I(inode)->ip_alloc_sem);
-		had_alloc_lock = 1;
-
 		handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
 		if (IS_ERR(handle)) {
 			status = PTR_ERR(handle);
 			mlog_errno(status);
-			goto bail_unlock;
+			goto bail_unlock_alloc;
 		}
 	}
 
@@ -1279,10 +1275,9 @@ int ocfs2_setattr(struct user_namespace
 
 bail_commit:
 	ocfs2_commit_trans(osb, handle);
+bail_unlock_alloc:
+	up_write(&OCFS2_I(inode)->ip_alloc_sem);
 bail_unlock:
-	if (had_alloc_lock)
-		up_write(&OCFS2_I(inode)->ip_alloc_sem);
-
 	if (status && inode_locked) {
 		ocfs2_inode_unlock_tracker(inode, 1, &oh, had_lock);
 		inode_locked = 0;
_

Patches currently in -mm which might be from wen.gang.wang@oracle.com are

ocfs2-fix-deadlock-between-setattr-and-dio_end_io_write.patch
ocfs2-fix-deadlock-between-setattr-and-dio_end_io_write-v2.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-02 22:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-02 22:16 + ocfs2-fix-deadlock-between-setattr-and-dio_end_io_write-v2.patch added to -mm tree akpm

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.