Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3479399imu; Sun, 11 Nov 2018 16:03:11 -0800 (PST) X-Google-Smtp-Source: AJdET5fyV9HnAj4YAgyvkGhyLt6DySd9zCV7Nof4aJnG4hoQoaKem2itc2Fc0TdVQOHdau2tBpzU X-Received: by 2002:a17:902:67:: with SMTP id 94-v6mr17292329pla.225.1541980991354; Sun, 11 Nov 2018 16:03:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541980991; cv=none; d=google.com; s=arc-20160816; b=RXcRo1uONcG5cBEJ3Z4GAGUQxafKlh38jBmVWMmXFZxXuMcktJzfTEBHf/Mji5aBVH ht+m8E8PLDroeKj156RFOavh9D/0l5S1vfTOtGz2AwGtfySaFmgo2fMtRU3lWLil8xVY AssVgSXXoRwK9WsYxnPDB3F1Qx8SlcICFJe7F/NkjNSCSTbpEEt5mjnGNsIue/wpRxF+ cBi1NPM9TwcwLu64uj0Dm29zEhJKeyf1LIf3Slcx7cYN1yRX1v8zyX1+hjafNMGZ8c+b h1i/aCIBsnaim4ywVsS2XPuAaRqxeAD2POoRDd0r2sMh+bIq5u3xw8t+Ax9AmRjMO+KW skFw== 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=EexQMs5l18nG9dy0IS13c+SsVuR1Tz1TnsnGNdiGjB8=; b=dSaQF8te3vLl+DpbQmUIcEbJTmAz6Tn8AuVT/vqST8+S5iA0UCh72PX+3aJhroLFyq VLFWoOGNNbPD80R/nI2E8mYcaomljRrL6unRhMNb0XM+QRU/baPmKaWwRViBKsot7Jdr 2ZAyhAW5F6TJTvFKYtkw0pKl5mIOqfoLGHgLXkE47cKVoQqOoHo0EMsLeYN9581Cu7PI 3cxuyaq5fhX9XT08pmh3pwTtWzxw7ZScsdfDgBzZHhdDMtkMS/OtR6YfY/5jAgC4wp+2 1QysEZE/b/elXSUehGHXini4ZbQTbRYp4xi7mpGBmiqqfFZEDwewncV4fv3etVEpYRHU 1E4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PmpwVl1z; 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 cd11-v6si17937528plb.59.2018.11.11.16.02.56; Sun, 11 Nov 2018 16:03:11 -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=PmpwVl1z; 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 S1732154AbeKLIRx (ORCPT + 99 others); Mon, 12 Nov 2018 03:17:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:34210 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732069AbeKLIRv (ORCPT ); Mon, 12 Nov 2018 03:17:51 -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 4485D22353; Sun, 11 Nov 2018 22:27:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975275; bh=m15dQen3davKIidG4RJ/ddGJClbMAQu+iOcmzuG/I7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PmpwVl1z7nB04AzS+uBJp9Q5MasvBD92MKUcqsi6FvPtyj/sid7S0s6TcilUJWmwK 2zM5fCeOwpgoXipopiCd8FB41TmwdvraP2/9E94+UEceWPeogbop99MTb66JoU9eb5 8Q5TXjK9e/FJUUeJqVSwZFBpTGtkCiG14LDxsQjA= 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.19 184/361] f2fs: report error if quota off error during umount Date: Sun, 11 Nov 2018 14:18:51 -0800 Message-Id: <20181111221646.140564851@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@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.19-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 @@ -1852,7 +1852,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 || f2fs_sb_has_quota_ino(sb)) @@ -1871,9 +1873,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); + } + } } static int f2fs_get_projid(struct inode *inode, kprojid_t *projid)