From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 985CB40D577 for ; Wed, 10 Jun 2026 00:26:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781051216; cv=none; b=WRtw70rHW9RcB0hryL5ppPbK3ABTEICooXWaT6egzgbiF+nXspEj4R2tF+hLjb8ZtoVtrZ62e+y+NnbeFSXqYRg/32bVLlKKK39SWHWyzqlcZvk1xiSl+P6DtbtmA9u1FFm8cvGS19enpGhykAmaP3/kR65WEPaAWLYOtafCbLI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781051216; c=relaxed/simple; bh=0z0WVYIicua7nODUWHlbYL/ZvF8BZWVbqq+j1myx1co=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ke1FP0K/UjbUm6vcdfYtJaYzX06d1yeCqN8KycJwBIM+HVGDog9m4XFlRDqXt+RQASt8tgHIrEXCLBI4YjlcmiwYsn3e/opEv8h6s7lTZbn23sIZXvf1gPOIysg5YEZApfN1G+t3HtpipXXUQw+xZnTU1U9tWXFoInQPILqxOXs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=c3iYbqR8; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="c3iYbqR8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 117DB1F00893; Wed, 10 Jun 2026 00:26:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1781051215; bh=IGvstAZW9nf+V7gkbUx6GISHABXm9vuy2cXtq4oBh4c=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=c3iYbqR81aGdMs9Dh8vRG4m5siMtQUXGoDOqifpOdVyCGFjEwWgwbr/8QnXCNN1Sp 22I8HL5Rz26UzMlp9y8ZjHiKvfXfHJByk1ZJWyhM3lnYoND4Z3rNn69TJLlsUT9EdN G0knQnH45hoeAjOpbd0Mn93rh4G5OmWSYsuaBYjYiqNyJU+rg3KngIMUz1pJcpfWKH f3BcDZQBssMSJFQ8scOIDXq4QGliW41x/iwaPbS/OVHSShactO9TyHZdOKx4WkrKQN HKu3cm1d4w1teUlM6Amk3MCnlVjDHx1IDz0LV/jA7+pmEjIyUGaOdR/IVq7DdG+pEJ U4cv31Ne1qYnQ== Date: Wed, 10 Jun 2026 00:26:53 +0000 From: Jaegeuk Kim To: Wenjie Qi Cc: chao@kernel.org, qiwenjie@xiaomi.com, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Subject: Re: [f2fs-dev] [PATCH] f2fs: reject setattr writes on large folio files Message-ID: References: <20260521110526.1967583-1-qiwenjie@xiaomi.com> Precedence: bulk X-Mailing-List: linux-kernel@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: <20260521110526.1967583-1-qiwenjie@xiaomi.com> On 05/21, Wenjie Qi wrote: > F2FS large folio support is read-only. It rejects writable opens and > mmap writes when an inode mapping supports large folios, but setattr can > still reach the inode without going through those checks. > > For immutable large-folio files, clearing the immutable flag keeps the > cached inode and its large-folio mapping alive until the inode is > dropped. A path-based truncate(2) can then call f2fs_setattr() with > ATTR_SIZE and change the file size without opening the file for write. > > The user.fadvise path adds another visible case: after the file is > reopened with large folios, chmod(WRITE) is documented to fail, but > f2fs_setattr() currently allows ATTR_MODE to add write bits back. We don't add this anymore. Can you update? > > Reject size changes and mode changes that enable write permissions while > the mapping still supports large folios. Read-only mode changes and > unrelated metadata updates remain allowed. > > Fixes: 05e65c14ea59 ("f2fs: support large folio for immutable non-compressed case") > Signed-off-by: Wenjie Qi > --- > fs/f2fs/file.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > index 71385ca4163d..3880ff5e6740 100644 > --- a/fs/f2fs/file.c > +++ b/fs/f2fs/file.c > @@ -1097,6 +1097,11 @@ int f2fs_setattr(struct mnt_idmap *idmap, struct dentry *dentry, > ATTR_GID | ATTR_TIMES_SET)))) > return -EPERM; > > + if (mapping_large_folio_support(inode->i_mapping) && > + ((attr->ia_valid & ATTR_SIZE) || > + ((attr->ia_valid & ATTR_MODE) && (attr->ia_mode & 0222)))) > + return -EOPNOTSUPP; > + > if ((attr->ia_valid & ATTR_SIZE)) { > if (!f2fs_is_compress_backend_ready(inode) || > IS_DEVICE_ALIASING(inode)) > -- > 2.43.0 > > > > _______________________________________________ > Linux-f2fs-devel mailing list > Linux-f2fs-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel