From patchwork Wed Oct 31 23:07:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 149915 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp117066ljp; Wed, 31 Oct 2018 16:30:06 -0700 (PDT) X-Google-Smtp-Source: AJdET5csoBbwDPURDyk9R/PtOtpWWm911NVg3kjd0K4Bgjk7hfXfETg3Oisroihn4YYWu8evS95J X-Received: by 2002:a63:e248:: with SMTP id y8mr2578843pgj.84.1541028606222; Wed, 31 Oct 2018 16:30:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541028606; cv=none; d=google.com; s=arc-20160816; b=kaFfgae/04lO0cJ5yQDW2FSBkrTcQXp5zKrFIIBf42E3DXWqZXg1WBNwpfi/Te4z+I JPdkmVeUhmuENjvk5CQm7T2J2U1fV9aZIJPnGhORTV0MJfwxPXDOKwiPe1iX1RsHx1nm SJTQwra+q8xw7tSApGLK3evQ3R5EhP5Pf/boSkDR6mjiFGU0koAuB7X6bIRlphWWU9g4 apv6lvXSi1Qky50ror3DrwEo/gMP5g3W1AF3AGbOkROt541DGBRiFNNdvh8MfL2BWa4P f5c4ccc547WUDpRKjOdmmZvgnyYnBLK95z0nBkBvAoQS0++YNS30sIN171MagErqLg5p LdmQ== 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=neFwI4jqqZM7BQ/KDB+czLOqkdF1c3WPoFqRxMvc/Xw=; b=WVTTnm6hq+PMJQpyev34JSqnmQHTGSmNF9rOAc9/7hn4h3AiXbW2gfl8aH59onSAtA AKVu4X9lbNRyUYznX31W2iz5HjhhEEgMzyxRyZORBoI/atUE1w4fz3uDYOZcWWQi6lGE J1uUoOoe7xhVNXu54T+jroIiqJBHahItN1lVk4en1KQqyrXPFYQVNSf86bjl40GFphr/ UEFC8PeYcaE5Jc1OKVnIAtR8kCNhBkvhEgfMxjW4vhSJPlKOCLXIKpKCyCzAqULQg2PR jKOuhd5efPBKy2uxpv+a5JdksCQn98SOyNgTjjOkq3QTi1VBGr6PYrTv8ibhZk3jXZdZ HMvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AUKZkRet; 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 69-v6si20213747pft.177.2018.10.31.16.30.05; Wed, 31 Oct 2018 16:30:06 -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=AUKZkRet; 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 S1730743AbeKAIJ6 (ORCPT + 32 others); Thu, 1 Nov 2018 04:09:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:60196 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730659AbeKAIJz (ORCPT ); Thu, 1 Nov 2018 04:09:55 -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 2EB6A2084A; Wed, 31 Oct 2018 23:09:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027383; bh=/HuDTDEc3gcaDaKMXd7gMKlIbW/K1yYOSuDjjy4HTN8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AUKZkRet5c3yl0NJqmTkX5w4gynzP3Hu9DiMNP9E4W4eO+ZSMbQFvL167uhydMKYI 4zb0EY2tnJIq0tkP5tCqD6OeV802IOKnaGR/kYA/hFjgvbhBbp3TmAIeo0k+5eBBdq KqOLRSneDi/OSSKu2bvj2ogtA/bOSKY6akS+k+Yo= 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.18 121/126] f2fs: report error if quota off error during umount Date: Wed, 31 Oct 2018 19:07:49 -0400 Message-Id: <20181031230754.29029-121-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230754.29029-1-sashal@kernel.org> References: <20181031230754.29029-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 742147cbe759..a3e90e6f72a8 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1820,7 +1820,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)) @@ -1839,9 +1841,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)