Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp2107799rdb; Sun, 24 Dec 2023 18:08:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IHms0IJKjAXTDMeKrPvFAm0EwWJcF95GtGyL0mIbdSHs6QCkn+mTX2jv5KZu2CWgmMYlPoW X-Received: by 2002:a17:907:3c14:b0:a23:7633:59ae with SMTP id gh20-20020a1709073c1400b00a23763359aemr3649759ejc.9.1703470100715; Sun, 24 Dec 2023 18:08:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703470100; cv=none; d=google.com; s=arc-20160816; b=kBX5rjOloNh749XTL6ClG/H+YA5z1372rHJFByB0hfpVD2exYFOaoZjK2FE2YCEB36 dyd5qmwmE8w5UIo3z9a9YXK38gaUNvxAfhcGtwur4ZTwBTH57UMbrX9a00Osl0+xT2e7 HypMEFdxHkw1xLZLo79bGxEpT/kx4QfMUPAfJY9CKBTK5c/OwgfdPzuzHqL15I7i8VdW VnLdr7hz0sHn4LsMkO+BxlflXvPvlbGM6PtNAV7DFoHgAlJ6xtMYk9t9ePPnFFOFnR6x XF9I8JbZneu9h3UySJKBVDSBNnJI485FyuUKPRTUGwOfvMuJD8gbn/B8neDrh4C9EuR/ B56A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=qLSfK8xGb+CwMrv5+cInd/MERfnvryzHJSdWTD4BQdw=; fh=OhmjDYp3ExwzwyPltoce1V34QyVJJF4Aml+LakKAWKo=; b=UewlZkWO6SsgD6pCKiIVsO1KRh4RaipQW2ujzo1B/sZS4mbnXynyg15cGEj4Tkzria DsnFz0mM7sHzys9rHn1LzD6vfOZv4R9cUX3di8rUP71XwHyppzwvZtwqRXp9EZwVcgP8 jUXBpiWuY70NSVaDGvMdSO3DCyPa8RvY5QlZ0ppfz9o8KyjVxpt8BB6y73T8ca5Xmrh6 T2I4igz9fR6K4iiQEEuAad5jGe1Mzo8gz0DpUHctTfFc1qTr62hQAoEycBX5ZvdYJNuU wJJI3p2vuyMP71ixYj3eQwjWsBsXaKQrsrQpZSLdtwBKqywVdZz3v4vTtuW5mI3vNO74 azYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=cpHNnWYd; spf=pass (google.com: domain of linux-ext4+bounces-566-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-ext4+bounces-566-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a23-20020a170906369700b00a2343c430d8si4230933ejc.483.2023.12.24.18.08.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Dec 2023 18:08:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-566-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=cpHNnWYd; spf=pass (google.com: domain of linux-ext4+bounces-566-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-ext4+bounces-566-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 459321F21C41 for ; Mon, 25 Dec 2023 02:08:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C97A3ED5; Mon, 25 Dec 2023 02:08:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="cpHNnWYd" X-Original-To: linux-ext4@vger.kernel.org Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 F1877A3F; Mon, 25 Dec 2023 02:08:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=qLSfK8xGb+CwMrv5+cInd/MERfnvryzHJSdWTD4BQdw=; b=cpHNnWYdyrhnmrYwlZaFDVgCQc SFWVWQPdScdhxcnwx/TZc0H45T4vULzyH0YAdAlhQtUIygJAX6F3mHOJJnA/GZMSMrKfK96CH4ieC nrjlY4fPjIOtOd8G+mkfIxQ7Bk5WVFDY4csqEIC3EgUBO9vr/tEKX7ubk3FcNj9xa4aNYicXENZq/ Uiu9oVRTTKiwop2PaesMPSJ+QgS8B7HY5NgTdMfQY4881yhPoDBO/Kx42z9kcNIJ/3iNoTmid9x8j bO3Zo1LHcObEfaWerqMRxLdmFkfGhALv4UhRpBn5dlz9c+Jzgis+MXrVcShfJoP+uIIFa88gEGvQj +oSu5ndQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rHaNm-006WCg-0G; Mon, 25 Dec 2023 02:07:54 +0000 Date: Mon, 25 Dec 2023 02:07:54 +0000 From: Al Viro To: Baokun Li Cc: Edward Adam Davis , syzbot+2c4a3b922a860084cc7f@syzkaller.appspotmail.com, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, tytso@mit.edu, yangerkun Subject: Re: [PATCH] ext4: fix WARNING in lock_two_nondirectories Message-ID: <20231225020754.GE1674809@ZenIV> References: <000000000000e17185060c8caaad@google.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro On Mon, Dec 25, 2023 at 09:38:51AM +0800, Baokun Li wrote: > In my opinion, it doesn't make sense to call lock_two_nondirectories() > here to determine if the inode is a regular file or not, since the logic > for dealing with non-regular files comes after the locking, so calling > lock_two_inodes() directly here will suffice. No. First of all, lock_two_inodes() is a mistake that is going to be removed in the coming cycle. What's more, why the hell do you need to lock *anything* to check the inode type? Inode type never changes, period. Just take that check prior to lock_two_nondirectories() and be done with that.