Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp889898yba; Thu, 18 Apr 2019 11:16:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqyWysAK8p5QX7kHejtVcyAt9yfTqNFgRYXjd9yB9MgUTXDb51awtHuMvpJm4mmpjvIKzbrn X-Received: by 2002:a62:ae13:: with SMTP id q19mr98222136pff.152.1555611370588; Thu, 18 Apr 2019 11:16:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555611370; cv=none; d=google.com; s=arc-20160816; b=NBmdBSKSeKgIfqj+jS+P+ejcrYi8B58qOpgMQCgS2+6uLaB+ytpWQU5MkiyR+QkY6Y /ym+C5oN8zMC8ocer8kCWN8aHEdMOQsZWvKYIlVanWB5YwyRiRmhtLKMLTAmGT1DQVUr KZeCmvo1nYXxCFNq2qnX4SwZVCf0xL+aOKvnbj3N2jicNSM0HCy1RqYRvjIODMjoFQHR Gq2Gt5EPkvBqD5KUCfCaXj2c9VmrC4S++DsZmKHCCF9y1Qp1SQjn4+Hbcbull9CkC0lg 1kdCgu4tN+R9fH/R9s1x4zB88FJqjm/U7D+z9h9ZKdcULG8muCo9y+8efs//fEJ7oUhz 1xdg== 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=/TWi4vGcbDd3pW7QWTz5L2amk+jeX8ir56TmZCPJnNc=; b=eNDd03jYyrJiVL2e1NMuaYf3AruU/rd2Re/bYEM+luM/llFFIePN/ZRfw6jMQHvnOO Xdp6cJCNgAJ8A4nYI/SVCZo9P3JHpsVnnlqhOVhG+ugSWGvwZrsXYWRXVSgiL7pcDVPg l+zrApAqBKBLwOvXuSH1FVBAWvpHZFF0gu1rEWjkY+mIUN5X8CfsJjSWLQA34yoe4rWi 7dPFERocIe1HD5OKryPsQF2GjFHX0o/Ixtvkx2hvrPvRYphRt8QAYegFuasVIwh5i5S9 9W5+OqBvw1pVzoEtoGb10wdOBwCmyxcW7F0At9FTTMqWelKKEHeRCJL3vA4+vN0akGMS wXGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Jl/xuqAX"; 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 m1si2306247pgh.8.2019.04.18.11.15.55; Thu, 18 Apr 2019 11:16:10 -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="Jl/xuqAX"; 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 S2391474AbfDRSOS (ORCPT + 99 others); Thu, 18 Apr 2019 14:14:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:45606 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404183AbfDRSM7 (ORCPT ); Thu, 18 Apr 2019 14:12:59 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 3110F206B6; Thu, 18 Apr 2019 18:12:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555611178; bh=su+vPTFnWpZh3p/InwWOGEwKQc4cfRYNn+dKZ4k6rGM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jl/xuqAXw6/mKbhOdgecakqZ+uMRYjSsvTCWfU9LAeoc658Ud1r31ykaQIGQqCZV5 XDtdIOuZJdECWQC0RdNPHjDW6T8d/nzvuB32OZjbE7+f6pR4aLXVkojGZppQ/ENeDL 6NO/fNCaW/avd7235MaGbeyvNa341meESJ6aigHc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Seulbae Kim , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.0 88/93] f2fs: fix to dirty inode for i_mode recovery Date: Thu, 18 Apr 2019 19:58:06 +0200 Message-Id: <20190418160445.689370123@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418160436.781762249@linuxfoundation.org> References: <20190418160436.781762249@linuxfoundation.org> User-Agent: quilt/0.66 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 [ Upstream commit ca597bddedd94906cd761d8be6a3ad21292725de ] As Seulbae Kim reported in bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202637 We didn't recover permission field correctly after sudden power-cut, the reason is in setattr we didn't add inode into global dirty list once i_mode is changed, so latter checkpoint triggered by fsync will not flush last i_mode into disk, result in this problem, fix it. Reported-by: Seulbae Kim Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/file.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index ae2b45e75847..30ed43bce110 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -768,7 +768,6 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr) { struct inode *inode = d_inode(dentry); int err; - bool size_changed = false; if (unlikely(f2fs_cp_error(F2FS_I_SB(inode)))) return -EIO; @@ -843,8 +842,6 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr) down_write(&F2FS_I(inode)->i_sem); F2FS_I(inode)->last_disk_size = i_size_read(inode); up_write(&F2FS_I(inode)->i_sem); - - size_changed = true; } __setattr_copy(inode, attr); @@ -858,7 +855,7 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr) } /* file size may changed here */ - f2fs_mark_inode_dirty_sync(inode, size_changed); + f2fs_mark_inode_dirty_sync(inode, true); /* inode change will produce dirty node pages flushed by checkpoint */ f2fs_balance_fs(F2FS_I_SB(inode), true); -- 2.19.1