From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5CE742DEA75 for ; Fri, 23 Jan 2026 04:04:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769141048; cv=none; b=TjxbvdimnMMvCn2UaGjTKFM1Cnp3tzhPk/PcOUfLzPLmgXuBSfc3K3qwirlgLgc0Ifvcv9w9zLbwVriECvVXG6nV4f6B9XuJjRx5jfdFnL88djtCcVtw3/pKrUi+D9w7FyEw5M81vDExQNzIdidRT4dd/l0J8nlLvH2TDBuZI+U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769141048; c=relaxed/simple; bh=fnP71bXuip4TbqjLM90QGyq1YAOJTk2KCtqIzNpoDD8=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=k8iYMMfkcrtKOfkbzzXlUiq50RO9kcUcWa8+KQv3AdVTtvqq+DM7n6Dcizf4LWFL2SKjanzcvEKo48B4guzDSoCw+0rvDNZ6CW5TJ7ws9qRN4qNSDPLPBuis/PUccfzd8Hfi2fZVHIXC99hZb8wx3s9OAuqPTltodbsooUIplAg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JDTmwkdo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JDTmwkdo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E3FEC4CEF1; Fri, 23 Jan 2026 04:04:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1769141046; bh=fnP71bXuip4TbqjLM90QGyq1YAOJTk2KCtqIzNpoDD8=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=JDTmwkdo4vAaL491EeOTY/qOXj9/MKu70ISzTxhaXT27Ab8bJsjnCxwrU5HOHNh4W wgtAT66jARIwMSSv1zyRGX2d+I98Y+ilDDBTQZLWyo9hIn/J7sT5oUyL82US1n8s7a C5nc7h1PVGOg38J06TlOw0xnZZyGExtJQ7YwwwsI6tjWP078CSI21DzWo2c/oOlCxP OJbRmp/RDUE4MSVhzONHDjGhTPeHalkJrz95UlDR/77PYqAnVd67OWEANpXR6nvHzU 8/xQvHc2isS2RL5eeIveW5UkoDRHN5I+nXM8vl4n9n45YRvS6cx5pepSUROp7MWJTd /ZanQ0tqQkdiw== Message-ID: <77f0a77f-532c-40f2-97c9-df1a064e4a89@kernel.org> Date: Fri, 23 Jan 2026 12:04:04 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: chao@kernel.org, jaegeuk@kernel.org, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Subject: Re: [f2fs-dev] [PATCH] f2fs: fix to prevent clearing immutable for large folio supported inode To: Nanzhe Zhao , Barry Song <21cnbao@gmail.com> References: <20260109024716.12047-1-chao@kernel.org> <2cdd4281-7e37-4dd0-91b1-1ab16ef772aa@kernel.org> <8c13ca69-a08a-41c7-bbef-0a79a5f44f93@kernel.org> <83419982-77ba-4dac-880e-bf59669a006f@126.com> Content-Language: en-US From: Chao Yu In-Reply-To: <83419982-77ba-4dac-880e-bf59669a006f@126.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 1/22/2026 10:02 AM, Nanzhe Zhao wrote: > Hi all: > > 在 2026/1/9 16:44, Chao Yu via Linux-f2fs-devel 写道: > >> w/ above locks, it seems there is still a race condition as below: >> >> f2fs_fileattr_set                read >>  - f2fs_setflags_common >>   - truncate_pagecache >>                         - f2fs_read_data_large_folio >>                         : read large folios >>   - mapping_set_folio_order_range >> >> Thanks, > > I noticed that the comment for `mapping_set_folio_order_range()` says: > >> "Context: This should not be called while the inode is active as it is non-atomic." > > I'm not sure whether cases like f2fs_fileattr_set falls into the inode > active case. > >>> >>> >>> If clearing immutable is indeed rare, we may leave this as is, since >>> writes are not supported until the page cache is fully dropped. >>> Eventually, we will support large folios on non-immutable files. >>> >>> Thanks >>> Barry > > Also, I couldn’t find any API in `include/linux/pagemap.h` that can > atomically set the > folio order range. However, I think dynamically setting large folio > order while an inode > is active is a reasonable requirement. In my non immutable file large > folio write work, I need to enable large folio support for a file when > it is converted from an inline file to a non-inline file. The lack of an > atomic API seems to be a blocker for moving large folio write forward. > Any idea on that? IIUC, our concern here is to avoid "echo 3 > drop_caches", right? If so, can we try this in new ioctl? - kern_path(target_file_path) - d_invalidate(path->dentry) - path_put > > Thanks, > Nanzhe Zhao > >