All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: <linux-fsdevel@vger.kernel.org>
Cc: Al Viro <viro@ZenIV.linux.org.uk>,
	mfasheh@versity.com, jlbec@evilplan.org,
	ocfs2-devel@oss.oracle.com, Jan Kara <jack@suse.cz>
Subject: [PATCH 6/7] ocfs2: Use s_umount for quota recovery protection
Date: Thu, 24 Nov 2016 09:12:41 +0100	[thread overview]
Message-ID: <1479975162-24060-7-git-send-email-jack@suse.cz> (raw)
In-Reply-To: <1479975162-24060-1-git-send-email-jack@suse.cz>

Currently we use dqonoff_mutex to serialize quota recovery protection
and turning of quotas on / off. Use s_umount semaphore instead.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ocfs2/quota_local.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c
index 8a54fd8a4fa5..32c5a40c1257 100644
--- a/fs/ocfs2/quota_local.c
+++ b/fs/ocfs2/quota_local.c
@@ -454,7 +454,7 @@ struct ocfs2_quota_recovery *ocfs2_begin_quota_recovery(
 /* Sync changes in local quota file into global quota file and
  * reinitialize local quota file.
  * The function expects local quota file to be already locked and
- * dqonoff_mutex locked. */
+ * s_umount locked in shared mode. */
 static int ocfs2_recover_local_quota_file(struct inode *lqinode,
 					  int type,
 					  struct ocfs2_quota_recovery *rec)
@@ -597,7 +597,7 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb,
 	printk(KERN_NOTICE "ocfs2: Finishing quota recovery on device (%s) for "
 	       "slot %u\n", osb->dev_str, slot_num);
 
-	mutex_lock(&sb_dqopt(sb)->dqonoff_mutex);
+	down_read(&sb->s_umount);
 	for (type = 0; type < OCFS2_MAXQUOTAS; type++) {
 		if (list_empty(&(rec->r_list[type])))
 			continue;
@@ -674,7 +674,7 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb,
 			break;
 	}
 out:
-	mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex);
+	up_read(&sb->s_umount);
 	kfree(rec);
 	return status;
 }
@@ -840,7 +840,10 @@ static int ocfs2_local_free_info(struct super_block *sb, int type)
 	}
 	ocfs2_release_local_quota_bitmaps(&oinfo->dqi_chunk);
 
-	/* dqonoff_mutex protects us against racing with recovery thread... */
+	/*
+	 * s_umount held in exclusive mode protects us against racing with
+	 * recovery thread...
+	 */
 	if (oinfo->dqi_rec) {
 		ocfs2_free_quota_recovery(oinfo->dqi_rec);
 		mark_clean = 0;
-- 
2.6.6


WARNING: multiple messages have this Message-ID (diff)
From: Jan Kara <jack@suse.cz>
To: linux-fsdevel@vger.kernel.org
Cc: Al Viro <viro@ZenIV.linux.org.uk>,
	mfasheh@versity.com, jlbec@evilplan.org,
	ocfs2-devel@oss.oracle.com, Jan Kara <jack@suse.cz>
Subject: [Ocfs2-devel] [PATCH 6/7] ocfs2: Use s_umount for quota recovery protection
Date: Thu, 24 Nov 2016 09:12:41 +0100	[thread overview]
Message-ID: <1479975162-24060-7-git-send-email-jack@suse.cz> (raw)
In-Reply-To: <1479975162-24060-1-git-send-email-jack@suse.cz>

Currently we use dqonoff_mutex to serialize quota recovery protection
and turning of quotas on / off. Use s_umount semaphore instead.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ocfs2/quota_local.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c
index 8a54fd8a4fa5..32c5a40c1257 100644
--- a/fs/ocfs2/quota_local.c
+++ b/fs/ocfs2/quota_local.c
@@ -454,7 +454,7 @@ struct ocfs2_quota_recovery *ocfs2_begin_quota_recovery(
 /* Sync changes in local quota file into global quota file and
  * reinitialize local quota file.
  * The function expects local quota file to be already locked and
- * dqonoff_mutex locked. */
+ * s_umount locked in shared mode. */
 static int ocfs2_recover_local_quota_file(struct inode *lqinode,
 					  int type,
 					  struct ocfs2_quota_recovery *rec)
@@ -597,7 +597,7 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb,
 	printk(KERN_NOTICE "ocfs2: Finishing quota recovery on device (%s) for "
 	       "slot %u\n", osb->dev_str, slot_num);
 
-	mutex_lock(&sb_dqopt(sb)->dqonoff_mutex);
+	down_read(&sb->s_umount);
 	for (type = 0; type < OCFS2_MAXQUOTAS; type++) {
 		if (list_empty(&(rec->r_list[type])))
 			continue;
@@ -674,7 +674,7 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb,
 			break;
 	}
 out:
-	mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex);
+	up_read(&sb->s_umount);
 	kfree(rec);
 	return status;
 }
@@ -840,7 +840,10 @@ static int ocfs2_local_free_info(struct super_block *sb, int type)
 	}
 	ocfs2_release_local_quota_bitmaps(&oinfo->dqi_chunk);
 
-	/* dqonoff_mutex protects us against racing with recovery thread... */
+	/*
+	 * s_umount held in exclusive mode protects us against racing with
+	 * recovery thread...
+	 */
 	if (oinfo->dqi_rec) {
 		ocfs2_free_quota_recovery(oinfo->dqi_rec);
 		mark_clean = 0;
-- 
2.6.6

  parent reply	other threads:[~2016-11-24  8:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-24  8:12 [PATCH 0/7] quota: Use s_umount for quota on/off serialization Jan Kara
2016-11-24  8:12 ` [Ocfs2-devel] " Jan Kara
2016-11-24  8:12 ` [PATCH 1/7] fs: Provide function to get superblock with exclusive s_umount Jan Kara
2016-11-24  8:12   ` [Ocfs2-devel] " Jan Kara
2016-11-24  8:12 ` [PATCH 2/7] quota: Hold s_umount in exclusive mode when enabling / disabling quotas Jan Kara
2016-11-24  8:12   ` [Ocfs2-devel] " Jan Kara
2016-11-24 11:49   ` kbuild test robot
2016-11-24 11:49     ` [Ocfs2-devel] " kbuild test robot
2016-11-24  8:12 ` [PATCH 3/7] quota: Use s_umount protection for quota operations Jan Kara
2016-11-24  8:12   ` [Ocfs2-devel] " Jan Kara
2016-11-24  8:12 ` [PATCH 4/7] ocfs2: Protect periodic quota syncing with s_umount semaphore Jan Kara
2016-11-24  8:12   ` [Ocfs2-devel] " Jan Kara
2016-11-24  8:12 ` [PATCH 5/7] quota: Remove dqonoff_mutex from dquot_scan_active() Jan Kara
2016-11-24  8:12   ` [Ocfs2-devel] " Jan Kara
2016-11-24  8:12 ` Jan Kara [this message]
2016-11-24  8:12   ` [Ocfs2-devel] [PATCH 6/7] ocfs2: Use s_umount for quota recovery protection Jan Kara
2016-11-24  8:12 ` [PATCH 7/7] quota: Remove dqonoff_mutex Jan Kara
2016-11-24  8:12   ` [Ocfs2-devel] " Jan Kara
2016-11-24 12:55   ` kbuild test robot
2016-11-24 12:55     ` [Ocfs2-devel] " kbuild test robot
2016-11-30  8:37 ` [PATCH 0/7] quota: Use s_umount for quota on/off serialization Eric Ren
2016-11-30  8:37   ` [Ocfs2-devel] " Eric Ren

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=1479975162-24060-7-git-send-email-jack@suse.cz \
    --to=jack@suse.cz \
    --cc=jlbec@evilplan.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=mfasheh@versity.com \
    --cc=ocfs2-devel@oss.oracle.com \
    --cc=viro@ZenIV.linux.org.uk \
    /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.