All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 2/6] ocfs2: Fix quota recovery failure on unmount
Date: Wed, 28 Feb 2018 12:17:58 +0100	[thread overview]
Message-ID: <20180228111802.23967-3-jack@suse.cz> (raw)
In-Reply-To: <20180228111802.23967-1-jack@suse.cz>

When filesystem is unmounted while there is still some recovery work
going on, it can happen that quotas get disabled before quota recovery
is complete resulting in failed quota recovery and inconsistent quota
accounting. Move disabling of recovery in ocfs2_dismount_volume() before
disabling of quotas to fix this race.

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

diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index ffa4952d432b..14c3d5ee6e24 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -1904,6 +1904,13 @@ static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err)
 	/* Orphan scan should be stopped as early as possible */
 	ocfs2_orphan_scan_stop(osb);
 
+	/*
+	 * This will disable recovery and flush any recovery work. This needs
+	 * to happen before disabling quotas as quota recovery needs quotas
+	 * enabled.
+	 */
+	ocfs2_recovery_exit(osb);
+
 	ocfs2_disable_quotas(osb);
 
 	/* All dquots should be freed by now */
@@ -1915,9 +1922,6 @@ static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err)
 
 	ocfs2_truncate_log_shutdown(osb);
 
-	/* This will disable recovery and flush any recovery work. */
-	ocfs2_recovery_exit(osb);
-
 	ocfs2_journal_shutdown(osb);
 
 	ocfs2_sync_blockdev(sb);
-- 
2.13.6

  parent reply	other threads:[~2018-02-28 11:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-28 11:17 [Ocfs2-devel] [PATCH 0/6] ocfs2: Fix various quota recovery Jan Kara
2018-02-28 11:17 ` [Ocfs2-devel] [PATCH 1/6] Linux 4.16-rc3 Jan Kara
2018-02-28 11:17 ` Jan Kara [this message]
2018-03-19  9:02   ` [Ocfs2-devel] [PATCH 2/6] ocfs2: Fix quota recovery failure on unmount Shichangkuo
2018-03-21 11:09     ` Jan Kara
2018-02-28 11:17 ` [Ocfs2-devel] [PATCH 3/6] ocfs2: Fix deadlock during umount Jan Kara
2018-02-28 11:18 ` [Ocfs2-devel] [PATCH 4/6] ocfs2: Move scheduling of dqi_sync_work up in call stack Jan Kara
2018-02-28 11:18 ` [Ocfs2-devel] [PATCH 5/6] ocfs2: Fix quota recovery for read-only mounts Jan Kara
2018-02-28 11:18 ` [Ocfs2-devel] [PATCH 6/6] ocfs2: Do not fail remount when mounted without heartbeat option Jan Kara
2018-03-01  0:40 ` [Ocfs2-devel] [PATCH 0/6] ocfs2: Fix various quota recovery Changwei Ge

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=20180228111802.23967-3-jack@suse.cz \
    --to=jack@suse.cz \
    --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.