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 4/7] ocfs2: Protect periodic quota syncing with s_umount semaphore
Date: Thu, 24 Nov 2016 09:12:39 +0100 [thread overview]
Message-ID: <1479975162-24060-5-git-send-email-jack@suse.cz> (raw)
In-Reply-To: <1479975162-24060-1-git-send-email-jack@suse.cz>
New quota locking rules will require s_umount semaphore for all quota
scanning functions. Add is for periodic quota syncing.
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/ocfs2/quota_global.c | 10 +++++++++-
fs/ocfs2/super.c | 1 -
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index 87e577a49b0d..cec495a921e3 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -634,7 +634,15 @@ static void qsync_work_fn(struct work_struct *work)
dqi_sync_work.work);
struct super_block *sb = oinfo->dqi_gqinode->i_sb;
- dquot_scan_active(sb, ocfs2_sync_dquot_helper, oinfo->dqi_type);
+ /*
+ * We have to be careful here not to deadlock on s_umount as umount
+ * disabling quotas may be in progress and it waits for this work to
+ * complete. If trylock fails, we'll do the sync next time...
+ */
+ if (down_read_trylock(&sb->s_umount)) {
+ dquot_scan_active(sb, ocfs2_sync_dquot_helper, oinfo->dqi_type);
+ up_read(&sb->s_umount);
+ }
schedule_delayed_work(&oinfo->dqi_sync_work,
msecs_to_jiffies(oinfo->dqi_syncms));
}
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index f56fe39fab04..5b9c0dfdb541 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -985,7 +985,6 @@ static void ocfs2_disable_quotas(struct ocfs2_super *osb)
for (type = 0; type < OCFS2_MAXQUOTAS; type++) {
if (!sb_has_quota_loaded(sb, type))
continue;
- /* Cancel periodic syncing before we grab dqonoff_mutex */
oinfo = sb_dqinfo(sb, type)->dqi_priv;
cancel_delayed_work_sync(&oinfo->dqi_sync_work);
inode = igrab(sb->s_dquot.files[type]);
--
2.6.6
next prev parent reply other threads:[~2016-11-24 8:13 UTC|newest]
Thread overview: 11+ 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 ` [PATCH 1/7] fs: Provide function to get superblock with exclusive s_umount 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 11:49 ` 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 ` Jan Kara [this message]
2016-11-24 8:12 ` [PATCH 5/7] quota: Remove dqonoff_mutex from dquot_scan_active() Jan Kara
2016-11-24 8:12 ` [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 12:55 ` kbuild test robot
2016-11-30 8:37 ` [PATCH 0/7] quota: Use s_umount for quota on/off serialization 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-5-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).