Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp170002imd; Wed, 31 Oct 2018 16:43:52 -0700 (PDT) X-Google-Smtp-Source: AJdET5cPLCg+l88dZJc0Sc6WNHoggDHQ3UJqSKaxxD/DbPVjI33idVqRa9+OmMNyP12h88jZvVfA X-Received: by 2002:a17:902:684a:: with SMTP id f10-v6mr5353606pln.242.1541029431998; Wed, 31 Oct 2018 16:43:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541029431; cv=none; d=google.com; s=arc-20160816; b=i2fwR429vCUbkUeFwXa5eWJ0tnxe1WnAsfbnhFengcZInovn3AaTG6zvjeVrbmo5oQ Gy4yDw8lbnnhrS48EIFTCHwWRnKkk3a8kMNn8C5+YzvchU5E+dnYd6nzx5dUIINUbw/n mS4SC9Ah09Spocq3blTNCpELNx5leXC0yqzgRMZo9wlGb41+vHk45+Zd66J4HeDAjs74 iKZfHzKJBFhwt9cXY9nWPQB3jx6n1MSxDKnk2Nx/dfKS6vVqYyR48bVscnaNgx+0prEn ZegUyeI/xh3/a5RL+TwsqZZxRXe+unixupNj42ivrk6BEa4fLntuLpTBcIxNamQU10hS M4KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=jUA0osDbhadJMPTsXiziXhbkcNS90V8shH28lkdFbCM=; b=QjHAkbQRLebGEzyVnlg5axTubhLuT7P91NeTbJ72S33QuSyLAvZZdEDhXasONIQtiD O4lioiQWJrxgfU7A/if6oGey89Q0m8/5tTP4d6UShyT7SvF4n43KME/AHotq8vYl45Aw GUmxD2C4sMnqL5mUkeN+QNkjg9B25a0vLZXcoewERVvmIsJ1xqOa7dYBN6A1mHcT6lmp uafDTmKoqPyJe4zfflOEbU26MdCBBUA+YfQ0OIncEvLApJJYEPgJnF2nv5cqlckCjez4 mmkeTydBcjj0GCFxzF6h+U/ZT2ayNs0DwRo/T9KBBT2PyOcexBiPsJv6lSybvRCwYxo1 /oXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="N7/fpJ+5"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 20-v6si28830099pfk.287.2018.10.31.16.43.37; Wed, 31 Oct 2018 16:43:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="N7/fpJ+5"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729349AbeKAIIB (ORCPT + 99 others); Thu, 1 Nov 2018 04:08:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:56368 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729319AbeKAIH7 (ORCPT ); Thu, 1 Nov 2018 04:07:59 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B95A92086D; Wed, 31 Oct 2018 23:07:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027268; bh=j8/hr9FiymPJJTSoCLvmBmWFlHETG5GKkM++isnkbqg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N7/fpJ+5fBKvQy9In33oC7MKkpUDZ1orhrOocrzxAgyXmRsHpO/o93qEv9C61tAmj nlJsAMcAlkvRyGx6WgyjnkAleQG4xtTdX1lv8zRiwRes8PAQbJkbLU7U4SmTe2dJjT A1N4f/56dOQwgyDQWjz8xKdK/yNvx4mbUZzVl9is= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Yunlei He , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH AUTOSEL 4.19 140/146] f2fs: report error if quota off error during umount Date: Wed, 31 Oct 2018 19:05:35 -0400 Message-Id: <20181031230541.28822-140-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yunlei He [ Upstream commit cda9cc595f0bb6ffa51a4efc4b6533dfa4039b4c ] Now, we depend on fsck to ensure quota file data is ok, so we scan whole partition if checkpoint without umount flag. It's same for quota off error case, which may make quota file data inconsistent. generic/019 reports below error: __quota_error: 1160 callbacks suppressed Quota error (device zram1): write_blk: dquota write failed Quota error (device zram1): qtree_write_dquot: Error -28 occurred while creating quota Quota error (device zram1): write_blk: dquota write failed Quota error (device zram1): qtree_write_dquot: Error -28 occurred while creating quota Quota error (device zram1): write_blk: dquota write failed Quota error (device zram1): qtree_write_dquot: Error -28 occurred while creating quota Quota error (device zram1): write_blk: dquota write failed Quota error (device zram1): qtree_write_dquot: Error -28 occurred while creating quota Quota error (device zram1): write_blk: dquota write failed Quota error (device zram1): qtree_write_dquot: Error -28 occurred while creating quota VFS: Busy inodes after unmount of zram1. Self-destruct in 5 seconds. Have a nice day... If we failed in below path due to fail to write dquot block, we will miss to release quota inode, fix it. - f2fs_put_super - f2fs_quota_off_umount - f2fs_quota_off - f2fs_quota_sync <-- failed - dquot_quota_off <-- missed to call Signed-off-by: Yunlei He Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/super.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 896b885f504e..d0d016f21307 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1852,7 +1852,9 @@ static int f2fs_quota_off(struct super_block *sb, int type) if (!inode || !igrab(inode)) return dquot_quota_off(sb, type); - f2fs_quota_sync(sb, type); + err = f2fs_quota_sync(sb, type); + if (err) + goto out_put; err = dquot_quota_off(sb, type); if (err || f2fs_sb_has_quota_ino(sb)) @@ -1871,9 +1873,20 @@ static int f2fs_quota_off(struct super_block *sb, int type) void f2fs_quota_off_umount(struct super_block *sb) { int type; + int err; + + for (type = 0; type < MAXQUOTAS; type++) { + err = f2fs_quota_off(sb, type); + if (err) { + int ret = dquot_quota_off(sb, type); - for (type = 0; type < MAXQUOTAS; type++) - f2fs_quota_off(sb, type); + f2fs_msg(sb, KERN_ERR, + "Fail to turn off disk quota " + "(type: %d, err: %d, ret:%d), Please " + "run fsck to fix it.", type, err, ret); + set_sbi_flag(F2FS_SB(sb), SBI_NEED_FSCK); + } + } } static int f2fs_get_projid(struct inode *inode, kprojid_t *projid) -- 2.17.1