From patchwork Wed Oct 31 23:05:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 149920 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp127173ljp; Wed, 31 Oct 2018 16:42:07 -0700 (PDT) X-Google-Smtp-Source: AJdET5eDiGHDac8ZeKFhsFL1sR4p19zf+SPL/+/lbT8swECcRxRgQz9Pk/LZzR3ERdNrv40zS7TU X-Received: by 2002:a17:902:2d81:: with SMTP id p1-v6mr1753781plb.97.1541029327579; Wed, 31 Oct 2018 16:42:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541029327; cv=none; d=google.com; s=arc-20160816; b=pPUoWLeoKjZmgT2+kqZ/eGTosXPVNdDpmDBiw+jW9wcVmTw0xPc9Km5Dsb/Ui5gc58 KxCUhWHVQfWnDP4zYXgk20ZoVf+C5AlkfYOc+f/vrtttPfiQcaE5WyLj3VxR0o65nOCG KtIddP9RK0vulm2ctsdrfBbnnAEA6HcQ35tUXrQV8TP9DwadYEPP1OsBtyWANuC7hxlZ 0QvV/+H01kkl2o66hhTo+Gl1kWYKIech1LOwo1xGgLqY25qKEOWHzXVIiasOJHIsa9C8 O51FFE9YFLStSgdc9mjJ0wkddl+gJhHaY6rm6BOSl0/vSiIk01kzy5LwArSsmy4DBWYE xmlw== 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 n26-v6si11639032pfe.218.2018.10.31.16.42.07; Wed, 31 Oct 2018 16:42:07 -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 S1729354AbeKAIIB (ORCPT + 32 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(-) -- 2.17.1 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)