Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp822523pxb; Tue, 3 Nov 2020 13:32:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJywEgz1zsn2bBGtC+8LeFRglhtegk1pRE0FyiTbATe4TNsUehRybvDCiWA6let5WWQ7rgT2 X-Received: by 2002:a05:6402:1750:: with SMTP id v16mr22134835edx.241.1604439140666; Tue, 03 Nov 2020 13:32:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604439140; cv=none; d=google.com; s=arc-20160816; b=buYqaRUAj0TBC6LDThyXtzC7tJEDoTWluuLGeqRZW2XVphmlHRtk8xERNIVQjvzoeO Io1uALMWamBK5EnYEKLAJ8wdh21ROr5yEYM5s7Q42CKwoZsTsaR1hJnTeEPeT1cedB9G hKhIaXK3CQYbpUiagd2ufCY9ID4RQ+Y2V9vuxEN2KXD3U+Y0tmriTjKo6VoTM98FMJhy /be2ytVnfmMXh15O12pGu9uujbAhqNtNdYmMw5pNl2RFdtwxp5dKGPoVEwpuTifJXlQj zzEAi4mo1MjwoN5PP0gaU1CC8gNmOP5i29O6T7nvjRp24GsoCMavmldYUvUdy5VjCRVr WZVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=N/9sOd3SH20BjeXgx5LB1QSl6fsD4ankLQe/UqXquqc=; b=0yGPPik7Jz5BCA/xiD2lMhWyA9EWRbWwFdC7o3gIHRvoiCa7YMPzakhg2N+3glP18c Dgj15qA5Itb4K3vSwWhiGnsytvCd5QWxJIrF8PUdGV+UXfPDUkl06jBBuAY9Ngfymmbs +ORIwuUb+YCfbpXG3oim4NYT8wKIVvkycvRE/YpFOdI5WOVVk4M9PkdFbE2SQuUE23ma xu29bCKTEGaaq6WnmnGZpSWN6HxTGOWUEQvYB7HB2SvcVw3Q9//Xq8Y6sXS9JvP+HPyY gPgXotwGrwNz4MS3nqSY9Gz3xoELwgCDjLwR6vfT6EWD9FaOCmXGR8EQPHvvarQteAV3 x0Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=o5k6lUcz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lr3si11384ejb.40.2020.11.03.13.31.57; Tue, 03 Nov 2020 13:32:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=o5k6lUcz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387969AbgKCV32 (ORCPT + 99 others); Tue, 3 Nov 2020 16:29:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:34140 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733081AbgKCU7M (ORCPT ); Tue, 3 Nov 2020 15:59:12 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 432B52053B; Tue, 3 Nov 2020 20:59:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437151; bh=P6PU9YgYPvKsSgsFwFUTvABFrFkeAW6iIYmJKiRzi94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o5k6lUczWXoVFoaXLvbmBtZcId5mrKDM7LswI0WnUaBBEXIlp1rjvUuXAXb8FGSbU UpMHC1yae7SsSW82TF8ln7AGOP1y4J2Se0dH6D8jqA9ynHYaNHJDWibYjdz5eMHNGR vTsD2iOcnXQ3aqlVXylPiJbj86+D1rpBkXZUK3rA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sascha Hauer , Kristof Havasi , Richard Weinberger Subject: [PATCH 5.4 169/214] ubifs: journal: Make sure to not dirty twice for auth nodes Date: Tue, 3 Nov 2020 21:36:57 +0100 Message-Id: <20201103203306.610490540@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Richard Weinberger commit 78c7d49f55d8631b67c09f9bfbe8155211a9ea06 upstream. When removing the last reference of an inode the size of an auth node is already part of write_len. So we must not call ubifs_add_auth_dirt(). Call it only when needed. Cc: Cc: Sascha Hauer Cc: Kristof Havasi Fixes: 6a98bc4614de ("ubifs: Add authentication nodes to journal") Reported-and-tested-by: Kristof Havasi Reviewed-by: Sascha Hauer Signed-off-by: Richard Weinberger Signed-off-by: Greg Kroah-Hartman --- fs/ubifs/journal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/ubifs/journal.c +++ b/fs/ubifs/journal.c @@ -938,8 +938,6 @@ int ubifs_jnl_write_inode(struct ubifs_i inode->i_ino); release_head(c, BASEHD); - ubifs_add_auth_dirt(c, lnum); - if (last_reference) { err = ubifs_tnc_remove_ino(c, inode->i_ino); if (err) @@ -949,6 +947,8 @@ int ubifs_jnl_write_inode(struct ubifs_i } else { union ubifs_key key; + ubifs_add_auth_dirt(c, lnum); + ino_key_init(c, &key, inode->i_ino); err = ubifs_tnc_add(c, &key, lnum, offs, ilen, hash); }