From patchwork Thu Sep 6 12:44:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 146088 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp463529ljw; Thu, 6 Sep 2018 05:44:58 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdag5DDGiH33nBo4XtFAXuToB/KISMjiIi0QnekRgkPZ5q3plARMiMoFmheJNFwCC+Ve/d1c X-Received: by 2002:a62:384a:: with SMTP id f71-v6mr2653136pfa.48.1536237898484; Thu, 06 Sep 2018 05:44:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536237898; cv=none; d=google.com; s=arc-20160816; b=CKG4r23RQJy8V5uWM/dJ0L+4uryMeMMjYQ0Ei2tXN/pv/7Ni+BYM35gzOY7JjgUBEq HnYAanT6QHZ0SM6VNtRT5VC+hMxrz9v4wLvbbyobDRLA64Jf1vgMqNqEYVrEXFTISpM7 wTqSudTy+2hvjlVg2kg91QL6dOK1uLDYk0KoLmeYRX32BT+lNG7138pVOkKqdPSfAnJD jtFBvRncsH33tjNEjbNzbumCuJvt+GEKBpDc41IMaPnf9ZqQ3SEvjXL1T4NicprobvF7 rieHKziaO/BIBOZYlo79GQKfPebj2ElVYn3h3egmMlumdke2aRBNNh5VH4WHg/oZ3zSJ +N7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=+48DXthDtsAcSFXK9e4h4QXXXzI3CXQEfMUbZJorbiQ=; b=kr/5jtdViJpTDMapGNKkUHZge4BQBPkf4uW7VmJ6lM8r2EOdBXW+hDCawlwrwfMCnm Cg+YfVN4iIDOOCRQrm++Uds9xf5c/3cUFZDZ84oAFXN0IXhyD0Z9AKs5nbckptUOivbW QjRDQtLO3c/619gHKHutOsAEaBbnZ/l1NOq/St+atzDOUfa4Hk2DbkdaV+Wdww41oy7z Ez4ZyZhnPvB7LUVunui8JuKo/hc6T1lhk1yA4PWWB3QRS45mVcWmsh4ZJ+SxLSYOd/nI IwX4GiEudd6Fm6jofMGuPF93nbTHzN9X7acoAg7XcWIUHMs/CGtCkYCZ76r+ADHlVg1E Vhlg== ARC-Authentication-Results: i=1; mx.google.com; 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 w26-v6si5033263pgk.372.2018.09.06.05.44.58; Thu, 06 Sep 2018 05:44:58 -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; 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 S1728734AbeIFRUP (ORCPT + 32 others); Thu, 6 Sep 2018 13:20:15 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:33679 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727609AbeIFRUP (ORCPT ); Thu, 6 Sep 2018 13:20:15 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id EA4B1E9C752EA; Thu, 6 Sep 2018 20:44:47 +0800 (CST) Received: from szvp000201624.huawei.com (10.120.216.130) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.399.0; Thu, 6 Sep 2018 20:44:39 +0800 From: Chao Yu To: CC: , , , Yunlei He , Chao Yu Subject: [PATCH 1/2] f2fs: report error if quota off error during umount Date: Thu, 6 Sep 2018 20:44:35 +0800 Message-ID: <20180906124436.89193-1-yuchao0@huawei.com> X-Mailer: git-send-email 2.18.0.rc1 MIME-Version: 1.0 X-Originating-IP: [10.120.216.130] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yunlei He 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. Signed-off-by: Chao Yu Signed-off-by: Yunlei He --- fs/f2fs/super.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) -- 2.18.0.rc1 diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 8f026ba226fb..c026aaccf218 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1874,7 +1874,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)) @@ -1893,9 +1895,18 @@ 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) { + f2fs_msg(sb, KERN_ERR, + "Fail to turn off disk quota " + "(type: %d, err: %d), Please " + "run fsck to fix it.", type, err); + set_sbi_flag(F2FS_SB(sb), SBI_QUOTA_NEED_REPAIR); + } + } } static int f2fs_dquot_commit(struct dquot *dquot)