Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3431692imu; Sun, 11 Nov 2018 14:58:48 -0800 (PST) X-Google-Smtp-Source: AJdET5e7uXWFburlsGJ54dcZLb1VAzCzKBE+7pzl4c3lc9qmVWXI9IzHw8C7Rks90JWc1nl9evI2 X-Received: by 2002:a62:fb14:: with SMTP id x20-v6mr17679334pfm.71.1541977128655; Sun, 11 Nov 2018 14:58:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541977128; cv=none; d=google.com; s=arc-20160816; b=Ju3LRkk4vLcD8B6VmoV51lVASqCTP/hDxUxfP1qEWus29BTAgvtZx5Q8ZCy5fbRxOa lagkFokK1F+0rFzDWrADRjbX0AdqPlrBJep439OEFjWX7wT2UgVG9ppPr42WvKl2pL2A ywAFLVPxyjDtEOCDnreAP7llTzrukuIwAVsRr4jhk2if+mC9KPn61GN7UPshCqjh2RNP 8rl5zM3dR+g9uOuKHq747bCqkBJpuph/Nqf+3PryIdvzzvw6Ow+MKW4WQaJ1eBYOzYdb 6eSgDmeY8yiQrTEGrf6ysSaBuZbqIDnb5nPHxd/OZQW4I7E+UMFqu7zriCa+DaCdILv8 8VnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9uMOvsZQb4MSTpQsTfSH6/OiEzKupA0/ih++W6zvM+4=; b=zCRXaT9FuL2Pq65sKDYKI7HmTXrZwVUGUSjxXWF2qDEoLBSo7O95LjK6c7o20AfXlg 3BypxLyudmQieXX/fR2VphJ1PebSS40p5aA6wTFzotp5GMw8sI65vLRI3IXAe7HU06X8 lGZ2uMFJvFukcW4Jh4i7L/1PZ7/DZLqQU8fKE8xyreW+2uo+ckHMKQ9OwwiJ6CiE2fML lw4zN3c5D7URebXR949kibhiXoC649F/2Jm6CBs/tAhcdcxvQeU5SI0TlTXo1DjAHJin hPJzdsBTmg3t1RudepFL2p1tazQxAjDixGZZMOukZhsGE0cvXr+1xUxunIGLXaQc+lfB QSxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MpTyprmV; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r18-v6si18006670pfc.253.2018.11.11.14.58.33; Sun, 11 Nov 2018 14:58:48 -0800 (PST) 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=MpTyprmV; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403813AbeKLIsL (ORCPT + 99 others); Mon, 12 Nov 2018 03:48:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:54242 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389111AbeKLIWn (ORCPT ); Mon, 12 Nov 2018 03:22:43 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 10F33223C7; Sun, 11 Nov 2018 22:32:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975566; bh=9m73BFX4HTHYT0TsU8uhweOq+krgDXq36pV7CMKocVc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MpTyprmVz8rQfub2y46ipSoWFt/s6kj74TllHEe5Lda6YM6tIxACE5/Lumf3bvVsK cPa/s6018wHrTq1AKmmySR7U41FLgxkl1mLfi8sarX20AdrHScRme5XitBX1TRZMwZ D+NTBuCAzCeoz8A3Ec7d2MY5336Lj2tRhJx/+o/M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yunlei He , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 4.14 103/222] f2fs: report error if quota off error during umount Date: Sun, 11 Nov 2018 14:23:20 -0800 Message-Id: <20181111221657.114212839@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221647.665769131@linuxfoundation.org> References: <20181111221647.665769131@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/super.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1488,7 +1488,9 @@ static int f2fs_quota_off(struct super_b 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 @@ out_put: 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)