All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joel Becker <Joel.Becker@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] ocfs2: Fix possible deadlock in	ocfs2_global_read_dquot()
Date: Tue, 2 Jun 2009 17:15:54 -0700	[thread overview]
Message-ID: <20090603001554.GD31976@mail.oracle.com> (raw)
In-Reply-To: <1243945445-25847-2-git-send-email-jack@suse.cz>

On Tue, Jun 02, 2009 at 02:23:59PM +0200, Jan Kara wrote:
> It is not possible to get a read lock and then try to get the same write lock
> in one thread as that can block on downconvert being requested by other node
> leading to deadlock. So first drop the quota lock for reading and only after
> that get it for writing.
> 
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  fs/ocfs2/quota_global.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
> index 1ed0f7c..edfa60c 100644
> --- a/fs/ocfs2/quota_global.c
> +++ b/fs/ocfs2/quota_global.c
> @@ -421,6 +421,7 @@ int ocfs2_global_read_dquot(struct dquot *dquot)
>  	OCFS2_DQUOT(dquot)->dq_originodes = dquot->dq_dqb.dqb_curinodes;
>  	if (!dquot->dq_off) {	/* No real quota entry? */
>  		/* Upgrade to exclusive lock for allocation */
> +		ocfs2_qinfo_unlock(info, 0);
>  		err = ocfs2_qinfo_lock(info, 1);
>  		if (err < 0)
>  			goto out_qlock;

	Can other nodes change the state of dq_off while you're
getting the exclusive?  I'm wondering if you have to retry the
qtree_read_dquot(), and I don't know enough about the code to say yes or
no.

Joel

-- 

	f/8 and be there.

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127

  reply	other threads:[~2009-06-03  0:15 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-02 12:23 [Ocfs2-devel] [PATCH 0/7] [RESEND] Fix some deadlocks in quota code and implement lockdep for cluster locks Jan Kara
2009-06-02 12:23 ` [Ocfs2-devel] [PATCH] ocfs2: Fix possible deadlock in ocfs2_global_read_dquot() Jan Kara
2009-06-03  0:15   ` Joel Becker [this message]
2009-06-03 13:31     ` Jan Kara
2009-06-02 12:24 ` [Ocfs2-devel] [PATCH] ocfs2: Fix lock inversion in ocfs2_local_read_info() Jan Kara
2009-06-02 12:24 ` [Ocfs2-devel] [PATCH] ocfs2: Fix possible deadlock with quotas in ocfs2_setattr() Jan Kara
2009-06-02 12:24 ` [Ocfs2-devel] [PATCH] ocfs2: Fix possible deadlock in quota recovery Jan Kara
2009-06-02 12:24 ` [Ocfs2-devel] [PATCH] ocfs2: Correct ordering of ip_alloc_sem and localloc locks for directories Jan Kara
2009-06-03 21:05   ` Mark Fasheh
2009-06-02 12:24 ` [Ocfs2-devel] [PATCH] vfs: Set special lockdep map for dirs only if not set by fs Jan Kara
2009-06-02 12:53   ` Peter Zijlstra
2009-06-02 12:24 ` [Ocfs2-devel] [PATCH] ocfs2: Add lockdep annotations Jan Kara
2009-06-03 16:31   ` Joel Becker
2009-06-03 21:48     ` Jan Kara
2009-06-03 22:42       ` Joel Becker
2009-06-04 10:22         ` Jan Kara
2009-06-02 18:43 ` [Ocfs2-devel] [PATCH 0/7] [RESEND] Fix some deadlocks in quota code and implement lockdep for cluster locks Joel Becker
2009-06-04  2:26 ` Joel Becker
2009-06-04 10:09   ` Jan Kara
2009-06-09 17:05     ` Joel Becker

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=20090603001554.GD31976@mail.oracle.com \
    --to=joel.becker@oracle.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /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.