From nobody Fri Nov 29 00:47:39 2024 Received: from mout.web.de (mout.web.de [212.227.17.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C149C145B26; Wed, 25 Sep 2024 19:54:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.17.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727294077; cv=none; b=VkOPWqLbjYwyrqzCYlDbwPh9RAW9QHKTZAqKCRJnOEw0NuX16Brr15jFpT3CrU2GvEEBSyOKTeAmlhlkQ2WU85+uctNyTJs6oMVLPUWTykktf+mJbv70vDn1xZ5vug9GwEDg0uUXQ2AjMn5FhoJUXhPyXbx19qxE6885tNxqYhA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727294077; c=relaxed/simple; bh=MHYemQ4iLJxEt+SBHZ8DDhtdDBmysgd2m8HWLVTbcLk=; h=Message-ID:Date:MIME-Version:To:Cc:From:Subject:Content-Type; b=nrRnRTBxZ83ZmJGp/mPeZ72lYSoKmqtlexdVw2cB2+htMWNDcJ31OJC3BFQJ3gywcH2k1LMgCyQfo1Toy0+KxWcZU8IhMqENgK5RLVoY+81qzRwd6YEjVW1EvS7Vc6hTayD2R9tQZooOZN7ZJ5EFn97nULLcV0Y/x13UIxm1xdo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de; spf=pass smtp.mailfrom=web.de; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b=WZlV1OKt; arc=none smtp.client-ip=212.227.17.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b="WZlV1OKt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1727294064; x=1727898864; i=markus.elfring@web.de; bh=oZFXgGZpN35Zb33XWrmn6Py5ABUqGOrhRxGCArCoPsQ=; h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:To:Cc:From: Subject:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=WZlV1OKt8vJe+eWHvXmXian3WVMAsLdis6oc6rAYeAgIWdG1xCuyf/SAQXqtr+s/ F4iFc60CGfBiPHosuHxSLBDaLHDOGOGEprWdxfMmboMVoM5FPs0u8Hp5qeTghNMPY R+Nf2MkmArRMvOpV3DJ50ipKgzQmaNhdNcr4cbeNO4rUyAE77MhWz8wxaYaDR/ceu 8/cEWChONkGNknDF6nHfzoYkTkxHehp2HG6nt1nZIsaBYjQlUA9ClogqPKQkBRQyM bLuYFYGZTThnJRGB2HMq4B5fmq/HmzJtZQkB80xGY+ikmLnRHnWPjJBs25c5NrpsV Rf9xT56OR6RACRguCg== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.84.95]) by smtp.web.de (mrweb105 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MRW6Z-1sWg9a3le1-00P9Iy; Wed, 25 Sep 2024 21:54:23 +0200 Message-ID: Date: Wed, 25 Sep 2024 21:54:18 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: linux-ext4@vger.kernel.org, Andreas Dilger , Jan Kara , Matthew Bobrowski , Ritesh Harjani , Theodore Ts'o Content-Language: en-GB Cc: LKML , kernel-janitors@vger.kernel.org From: Markus Elfring Subject: [PATCH] ext4: Call ext4_journal_stop(handle) only once in ext4_dio_write_iter() Content-Transfer-Encoding: quoted-printable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rQ/GvsAcS1C5Q898EFpiEleHL8AtbVqc60r epB0pNSSbwdPI/a7sCbY1guA== Content-Type: text/plain; charset="utf-8" From: Markus Elfring Date: Wed, 25 Sep 2024 21:47:39 +0200 An ext4_journal_stop(handle) call was immediately used after a return value check for a ext4_orphan_add() call in this function implementation. Thus call such a function only once instead directly before the check. This issue was transformed by using the Coccinelle software. Signed-off-by: Markus Elfring Reviewed-by: Jan Kara Reviewed-by: Zhang Yi --- fs/ext4/file.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fs/ext4/file.c b/fs/ext4/file.c index f14aed14b9cf..23005f1345a8 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c @@ -564,12 +564,9 @@ static ssize_t ext4_dio_write_iter(struct kiocb *iocb,= struct iov_iter *from) } ret =3D ext4_orphan_add(handle, inode); - if (ret) { - ext4_journal_stop(handle); - goto out; - } - ext4_journal_stop(handle); + if (ret) + goto out; } if (ilock_shared && !unwritten) -- 2.46.1