From patchwork Wed Oct 31 23:09:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 149912 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp111119ljp; Wed, 31 Oct 2018 16:22:33 -0700 (PDT) X-Google-Smtp-Source: AJdET5ePQMyTRHVDFGgRYxkFjDZb9xDHkt5tNIElmaQ8v34FtdwMVsiLnJBkUm80kd6MmYBufm6o X-Received: by 2002:a17:902:e81:: with SMTP id 1-v6mr5309057plx.48.1541028153500; Wed, 31 Oct 2018 16:22:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541028153; cv=none; d=google.com; s=arc-20160816; b=DdGiYIUQqds2+npiHXRT+2+Ij9ZtAtz1ypxtUqtDV3gFrr2wCzlJXQNHVcicHgqZvq UU8ul5BC5vkY12NkId/no5wzp/xQAHInRP00TAdkALB0I/icIbiA9fVvz8kbR5QT+ide y1zqoVXoZJkJTq7++O8d8UW11WQ6EbfHu5XgfmWvPJ7xIwxWYZ/PVX5JQGbwIX9WVopf bS2uAyux/50JqRAwUuFN0Q+uENG656QYd+ZzgmeM+VmDpA9/EcHr1/wNglhFIvo3G8Ym 1ZpyHJwmh7Sd9ME6YZxDga4pXyQuWOYw0N/Coo1SgcC0jW7UWSIWynwRmdoAPm0meaq6 alJA== 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=KfwBBXUY7KPFSKuX+ysNfgSSTPRT4Us99Q3vxyTNxwE=; b=Tfrk2Eq8CBa/HTiTpX6i11hb7xbzyOU4agTZeKF6ASEsmXzrqZC/S/0dH5PNsqiJ49 13mC4KhiMemZdAUScfyOjNvzS+upHss7zg1bo5e5pVx7Zbq3Ok4h1Pz96KohiYCeu3yC z8Q1+sh7aOESJkai04hnb3Gn4gPcaBE8+KGKCjbsksi3Nq/EfkKFZ3iVXlWTc0yDDbBS itbDEjJBoxKd7SeXfvSk+FdW3zyCLeKueVWP4Mk2iYM2hgDeYVYR3KcifN21E0YVHTuY A+Le1ubyrpbdrq9OIYcoHCJ9s3JqY0US+2WpVbZb7jChfBpFGr7fFTP/RA7lI81cpHey aZiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Hpp3HWVV; 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 h37-v6si28501496pgl.370.2018.10.31.16.22.33; Wed, 31 Oct 2018 16:22:33 -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=Hpp3HWVV; 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 S1731661AbeKAIWq (ORCPT + 32 others); Thu, 1 Nov 2018 04:22:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:34080 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731339AbeKAILB (ORCPT ); Thu, 1 Nov 2018 04:11:01 -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 B066520840; Wed, 31 Oct 2018 23:10:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027449; bh=o4ApQr+p81eAIktmU8Gd/ftbRsga8GY5v1fFnZ4MYn0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hpp3HWVVPuVgMDnloXpVrPKivcQt5YFuNrpIZ31IqpsSCFT6FXa43KeoSVhOhqJlc mJ2+6WiwZYgUqXioXHQh4sS3KplyyU0xUIlZ7ZU1jGnLMleoO7zTeCLnPb/dnZ23Y6 Hnqcu6y65rJMUJjQIMsCS0/batqsoQty5SSK8gso= 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.14 68/73] f2fs: report error if quota off error during umount Date: Wed, 31 Oct 2018 19:09:43 -0400 Message-Id: <20181031230948.29203-68-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230948.29203-1-sashal@kernel.org> References: <20181031230948.29203-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 eae35909fa51..7cda685296b2 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1488,7 +1488,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) @@ -1507,9 +1509,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++) - f2fs_quota_off(sb, type); + for (type = 0; type < MAXQUOTAS; type++) { + err = f2fs_quota_off(sb, type); + if (err) { + int ret = dquot_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); + } + } } int f2fs_get_projid(struct inode *inode, kprojid_t *projid)