From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.51 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796480705; b=m+VWMpB57ThIdHU2eqJg87Vw8SAdPkREWG/AwO4KOUqoX9i3MwwcF2GShkPVyDcf74GK IrhtylTxMlxzDIcpI/ai6F/6YTZ6+5w3/WVkH4otn2ZzBKlOPPG2f6VQwFxR9JMA6I0+k +dXL33BOorFIDupUzGuB8/j+4OufAV6ZJDl4cVEsrRTHafHQXYNmgsf/6WDux3Lnlt/Lf RMjFf5UUeZ+8QteqN4CwOWlWMFviza3F+4Rr7ndD8NLsu919/TbpIOPYeDZ55bDSjIjU7 PaQt7A3uxSllaKt16PJ0Rn6nzh4LJnuO9C8x3Ry9bZMTQApTTbpxvVIW79XwHSfle3w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796480705; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=4nF5ALb5e67C1DcnGnG+4sXZI7QJswFHbhlEz1lQm3Q=; b=mDH7oPA49c4/IySDddJP96w6HB+g4mmULuARMrsNnsLSx0P0k1Y5oWXbPZtKxo6i2pKF QFKMxYDilCUXnm+NjedQAE6jjkyZEnmqjxda+4pFk4qc7Thxxkhpds4HA+stje1L7mtdM DdygSgIS2mhDAfxEUkh8uyjCwSyf4LeKjp0UYvnppJuRXG8nvFygRiCXaMEZPRphZgp64 aeKkIkeHL7ivArDQ1krLXW+3DWbVvZQRP9rOdfpjjRL0k0dvKH1z53V+xjIoSumxVv9V/ k2KhbubE5cSeprBszYpWZfGEUYVYJxc93RgEDKKQOm6qmiB1PDuajsFDNSgBEH6WBqA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=NIARjmCX; arc=none smtp.remote-ip=209.85.221.51 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E0B460A6F66 for ; Sat, 5 Dec 2026 14:25:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1E0B460A6F66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=NIARjmCX Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-4a68190a2a7so1451928f8f.1 for ; Sat, 05 Dec 2026 06:25:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796480703; x=1797085503; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=4nF5ALb5e67C1DcnGnG+4sXZI7QJswFHbhlEz1lQm3Q=; b=NIARjmCXy1kgkULZV7vTo10aNSpuYANoyNEBZpAhCGqqeTIWoO2J1d+4KGhTN3ixhz YWXPiRjVLCR1Lba1gi3tAE4wLuXCrQhbCbjyJ9n3PYcs9r0LPn30p+QMxfRr4+jkdcKk 0jX1d/tS/a+r4KyWsu7LA28KiHxH4oWyykQsjApFPkUZ3HkaTgSkZybl3BkKuBnvq7Bq q6fGbenbpMvTGi3+nlWHNQ7aNPsuNcOazPinPO0xcIpao9WEkDmXfdiL+5qZo3kCaHo8 ZhKQjMogXi2HCHFaS9vizzQp2pf6H9MMovG2st5F7+2Mkp3l+1VumIy1CN9rYrPihrvB tpSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796480703; x=1797085503; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=4nF5ALb5e67C1DcnGnG+4sXZI7QJswFHbhlEz1lQm3Q=; b=ErXJOOyzNaoXb+bEgGTxFrfzuVIdI4+j3+JoKRa8WG7tcbLZNZ6kMdLbEYBjQeuhnb iRVHfqkxQ26Ei7UR6IDE4nJ/TwIcukHGA9KcN8cvracwrktNYaoFwYDZ/B9wwf4w0lf5 MpZTpuIr9E5LXqMyXuWfRWGMTuVL2S9Gzl/EDTT3GKNdPslrdA+46XwDGmHrlngqjILx UVb9u8yFKoKrzyarK8Hb3ak/QxxClhfs+zSLgbiUQBfLAe8EEsrr/phFLuLTNoPT4P16 B9sQVYBfJgRO6p3WaDHT1W7/omgN0/mpUmDmqNB7iWaNdVl89DLK0JwUWPiCCyAQYPyo f6Zg== X-Forwarded-Encrypted: i=1; AL+hErHwrY6fU8/kAdXAiJ+XmjzvMl05XydkBsbh7TIOdzp+/o3Hd8wqC1Tq44yNRfEUt+tbRyuWG/b0tlw=@vger.kernel.org X-Gm-Message-State: AB4q+uG2fd03ahoxEfLTTvVqxVkKTLG5NXkhAO7xDh2OjyRmYry67R/f vr7JEhUEPCYtpGRZPj6oQdxxbzRGUlyLOZMFj045GvQz9Et8J3RCvvUM X-Gm-Gg: AZFdTZcLRkvbBtsT8PtDjOqFOjaSPg0t/Pql8AySOrbtmW3CCJtv24NtA9D5JQ4CxFZ teC1AEyuFc2F8TfoclgxmPcUR4hRvB2hVzy+WErKrbLRFlB7B31P6hCTZ5O2/gwSHEHXNo7EjPp aIIICaHhRl9zxA4Z0gg353VAqUz4taqsXx34kqhC//ABpahU99Sagizai+oI5m/t4VoEJ3jaCqa e/IqIYMwghFxO2RWTB/3hLT+sC1nuWHsOUEdj56j3nSQCX9OoqQGW28pOVPbybc3o636wB/76W3 twK9CeCkf5I0ftBkx4u2nyryCsXA/XIscG0YeoI2WM+YV5m2cIxbnJo2iJ0dlWu8CfR67vU/VXd 2HKf6jIG1z/O+ub050Njv9hYH3HGfZtjckRJy7p+qgPKPDiW1/hHhCZ7uKGAW32QJ9DmCa7bqyy XO9yi0G/4C/CpAUbsKyXzLZ+Gb2dcp1KYivB3tXJo3nRO9tyC87J4olqGfI50cLUJlBfaa7kwUw Ffx8Sy+kttQjVYQC1zeTJuNTA6VZsHeSq8L6BUkfsxJj+BZsQrm/ihT6W1Lvt6wwuVL8VTjQzOy jL8gaKB1oKdwbPGnu98XEmIp X-Received: by 2002:a05:6000:4a13:b0:48e:3ebc:d242 with SMTP id ffacd0b85a97d-4d1eb7d7142mr9650701f8f.37.1796480703347; Sat, 05 Dec 2026 06:25:03 -0800 (PST) Received: from infinity ([2001:b07:5d26:7a6a:365a:60ff:fe0d:cfc6]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4d174d08d42sm10776969f8f.55.2026.12.05.06.25.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Dec 2026 06:25:03 -0800 (PST) From: koraynilay To: Namjae Jeon , Hyunchul Lee , Jonathan Corbet , Eric Biggers , "Theodore Y . Ts'o" , Jaegeuk Kim , Alexander Viro , Christian Brauner Cc: Shuah Khan , Randy Dunlap , Chuck Lever , Jeff Layton , Jan Kara , Alexander Aring , "Darrick J . Wong" , Andrey Albershteyn , Amir Goldstein , Miklos Szeredi , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Lauri Gates , Christoph Hellwig , Dave Chinner , linux-btrfs@vger.kernel.org, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, ntfs@lists.linux.dev, linux-nfs@vger.kernel.org, linux-api@vger.kernel.org, linux-doc@vger.kernel.org, linux-unionfs@vger.kernel.org, koraynilay Subject: [PATCH v5 08/12] fs,overlayfs: add fileattr masks support on get Date: Sat, 5 Dec 2026 15:24:07 +0100 Message-ID: <20261205142411.164484-9-koray.fra@gmail.com> X-Mailer: git-send-email 2.56.1.dirty In-Reply-To: <20261205142411.164484-1-koray.fra@gmail.com> References: <20261205142411.164484-1-koray.fra@gmail.com> X-Mailing-List: linux-api@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add transitional get_only_masks selector in file_kattr for filesystems that want to advertise their read-only mask on GET but don't want to receive masked requests on SET. Use it in ovl_fileattr_get() to ask the VFS for unmasked SET if the underlying filesystem returns masks on GET, otherwise ovl_set_protattr() treats fa->flags as the full set of flags and clears IMMUTABLE/APPEND. Signed-off-by: koraynilay --- Amir, is this commit message correct? This is what I understood, but I'm not 100% sure. I wanted to mention the actual bugs fixed, but since I haven't understood them that much I didn't want to just leave the robot's explanation in the commit message :D Thanks. fs/file_attr.c | 2 +- fs/overlayfs/inode.c | 3 +++ include/linux/fileattr.h | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/file_attr.c b/fs/file_attr.c index 7bfd7651d1d8..7ca19364d8c9 100644 --- a/fs/file_attr.c +++ b/fs/file_attr.c @@ -401,7 +401,7 @@ static int fileattr_set_from_masks(struct file_kattr *fa, static int fileattr_set_convert(struct file_kattr *fa, const struct file_kattr *old_ma) { - bool fs_has_masks = old_ma->has_masks; + bool fs_has_masks = old_ma->has_masks && !old_ma->get_only_masks; if (fa->has_masks) { if (!fs_has_masks) diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c index 92df4f5c071e..8d4753fd2d92 100644 --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c @@ -747,6 +747,9 @@ int ovl_fileattr_get(struct dentry *dentry, struct file_kattr *fa) err = ovl_real_fileattr_get(&realpath, fa); ovl_fileattr_prot_flags(inode, fa); + if (!err && fa->has_masks) + fa->get_only_masks = true; + return err; } diff --git a/include/linux/fileattr.h b/include/linux/fileattr.h index 8dcabbb294fa..3a8a00545686 100644 --- a/include/linux/fileattr.h +++ b/include/linux/fileattr.h @@ -89,6 +89,8 @@ struct file_kattr { bool has_masks:1; /* struct has valid masks (get/set) */ bool use_masks:1; /* in-kernel callers need to set this to use masks (set) */ + bool get_only_masks:1;/* Transitional: filesystem doesn't support + rw_mask for set, but supports ro_mask on get */ }; int copy_fsxattr_to_user(const struct file_kattr *fa, struct fsxattr __user *ufa); -- 2.56.1.dirty