From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A300244694 for ; Mon, 26 Jan 2026 15:42:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769442132; cv=none; b=Ds2g0gLMqyo0mteSyS2Xfbyy29novKBE99yDKzj2oT58hGHUL8do96NcOkGmRUzo3Tye22D5Y8ZpER8lz4xSeLZgECSvK159jF539B3tJSWjdjUwiXlghGFdoN9tY6Xx0AHFBkspJ0yS1l+B880DdTPb9Pb/y9olJJYFMo63JDM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769442132; c=relaxed/simple; bh=tDX4/j/4ahIfg9o5XRxBR2QuO+1qYjcCp7uZcGAX03Y=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=PgNJBTp1BQsCyOJC2Izn9snrJUUc+gbmnq9x6bV8JdWdha99mpFzY6+qs78ZiMdb4lUnEJTutH6UE+ePFVs9MSQlYQC9YaMK2/W25XNP7PqjJxCjjzRnFKBTUQ2V3+APXoAvBOvJYYfgV6S9rLNdtblp9ndRxlaYjWNzFGhSobM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Rkry+gta; arc=none smtp.client-ip=209.85.210.177 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.b="Rkry+gta" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-81f4dfa82edso1932471b3a.0 for ; Mon, 26 Jan 2026 07:42:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769442131; x=1770046931; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/KlZEx+u0e43aEKml6MIGqsrdovDvYZ8jhKvUs4y8zM=; b=Rkry+gtaQzFD2JFs7fslO+jz3JiSSZ/eWp8x/NoKgaFXLWH6Y8Yv12fy780wzy33iX iRbk6ih/gSn6JjO/4rmxYPBW+5UzrgIs2S+QAgI4Ert7zkjzGrvf7yzcSj4weemR5AmB L8y4oddm8p3h+jsESK4nNtq83fq1YMJJXJBqFLyyTsKySBawyXre+OoqaFNR+RLfUrCm nCLjDDuCFKF6xk6KO722hBv0g35fcTDkbqvSMnQSgNW0SRlLo+6Hh+5DkKp7pQrdX42Q TZQG2VfwbV8DJ5Sq4PfdQc2f2ONnghf2cTcD/ncYlOPVTUAzASfci9juRhfVvD4CkEw3 PGtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769442131; x=1770046931; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/KlZEx+u0e43aEKml6MIGqsrdovDvYZ8jhKvUs4y8zM=; b=ef8/q/VoM/KwAQzXvTk7rITwg8HL4rxaN7jk+RGxe00VvW5Ya1fkOhxwqNdUEmUo0X tRrgEcOLvMWshtxlBT1fPLVIBXt7/Yv/roWDsAldugwRtrI9FslNL/nu3MaVK1Jt4dTv UHePStXaaYDVorTn9BEn9xrgu5VLZLZVcrbme/+olTrXP3mgDS0AR0OLyJJh10/89HuS h6VaFYL4xb2+eJ8UJ8E+UMzyHdfUWRnctw7tQaI94xrZs4M1w1zDQ5PiobM0avIS7PL+ cECLBxn8csPplHKgA08nCOm+iSnYAoHVuQ81BHyPnN2TyLHH5BR0SxIfG2cf3/U/C7Zk GdjQ== X-Gm-Message-State: AOJu0Yx9HdUJ4iN+eXCWuYPiDXYPhfuvDBQMfwbQRMSQ6su1+BKxeThg fAGXt7Ocevu2GlIOffEcmnkxavnqd6CYwYJQbRqfxGGinFV63oT3pVi2 X-Gm-Gg: AZuq6aJYdLAvS01OP2Bkk5CQ6MUimGdpOq5TszksdW/5iDauH62/brRTXrYebBHLXrQ e9v3r0wKtIoW5ScSN60ex5P39Tjl3s5xnT9/01IL0jJqJPBC7SzPqUL5QS3uElK8s9Z3Mc9PqUZ ZSNDfC58oZREDVVO0fjMCRBJJtZTjcZ21gS3czio8KJiZVeNvErzeNIySIkU6b6BPrS0QJCR7TX G0E217xspCbQMnh4awKJvgAYAMuG3GQo3YMYHpeBR6mjF7IcXEDDQaGv+44l32XQ7LlHzr4IH8r YSu6/HrRN4691ynzPv6DJ+A9oK2JFGjk8JQvpbVGp3J/UC89gc89ZeitiTazqjq/DwVIDyc+sxV KlcYf+SYkhpbn5XCGhrPNGV+MWdKulAwg87S7eVTI/YBlp79x3jKseg8XIXjt5zYgKVZACroaJC OZcolcakC21EAauK5icuHVURXFy+ODm4oxnRBAAxTKSvg= X-Received: by 2002:a17:90b:3b44:b0:341:abdc:8ea2 with SMTP id 98e67ed59e1d1-353c41c97a7mr4093004a91.37.1769442130618; Mon, 26 Jan 2026 07:42:10 -0800 (PST) Received: from toolbx ([103.230.182.3]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3536d88b098sm8649100a91.3.2026.01.26.07.42.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jan 2026 07:42:10 -0800 (PST) From: Dorjoy Chowdhury To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, jlayton@kernel.org, chuck.lever@oracle.com, alex.aring@gmail.com, arnd@arndb.de Subject: [PATCH v2 0/2] O_REGULAR flag support for open Date: Mon, 26 Jan 2026 21:39:20 +0600 Message-ID: <20260126154156.55723-1-dorjoychy111@gmail.com> X-Mailer: git-send-email 2.52.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Changes in v2: - rename ENOTREGULAR to ENOTREG - define ENOTREG in uapi/asm-generic/errno.h (instead of errno-base.h) and in arch/*/include/uapi/asm/errno.h files - override O_REGULAR in arch/{alpha,sparc,parisc}/include/uapi/asm/fcntl.h due to clash with include/uapi/asm-generic/fcntl.h - I have kept the kselftest but now that O_REGULAR and ENOTREG can have different value on different architectures I am not sure if it's right - v1 is at: https://lore.kernel.org/linux-fsdevel/20260125141518.59493-1-dorjoychy111@gmail.com/T/ Hi, I came upon this "Ability to only open regular files" uapi feature suggestion from https://uapi-group.org/kernel-features/#ability-to-only-open-regular-files and thought it would be something I could do as a first patch and get to know the kernel code a bit better. I am not quite sure if the semantics that I baked into the code for this O_REGULAR flag's behavior when combined with other flags like O_CREAT look good and if there are other places that need the checks. I can fixup my patch according to suggestions for improvement. I did some happy path testing and the O_REGULAR flag seems to work as intended. Thanks. Regards, Dorjoy Dorjoy Chowdhury (2): open: new O_REGULAR flag support kselftest/openat2: test for O_REGULAR flag arch/alpha/include/uapi/asm/errno.h | 2 + arch/alpha/include/uapi/asm/fcntl.h | 1 + arch/mips/include/uapi/asm/errno.h | 2 + arch/parisc/include/uapi/asm/errno.h | 2 + arch/parisc/include/uapi/asm/fcntl.h | 1 + arch/sparc/include/uapi/asm/errno.h | 2 + arch/sparc/include/uapi/asm/fcntl.h | 1 + fs/fcntl.c | 2 +- fs/namei.c | 6 +++ fs/open.c | 4 +- include/linux/fcntl.h | 2 +- include/uapi/asm-generic/errno.h | 2 + include/uapi/asm-generic/fcntl.h | 4 ++ tools/arch/alpha/include/uapi/asm/errno.h | 2 + tools/arch/mips/include/uapi/asm/errno.h | 2 + tools/arch/parisc/include/uapi/asm/errno.h | 2 + tools/arch/sparc/include/uapi/asm/errno.h | 2 + tools/include/uapi/asm-generic/errno.h | 2 + .../testing/selftests/openat2/openat2_test.c | 37 ++++++++++++++++++- 19 files changed, 74 insertions(+), 4 deletions(-) -- 2.52.0