* [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode()
@ 2026-06-30 10:53 Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 01/31] " Jori Koolstra
` (32 more replies)
0 siblings, 33 replies; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
There is a comment in vfs_prepare_mode() that says:
Note that it's currently valid for @type to be 0 if a directory is
created. Filesystems raise that flag individually and we need to check
whether each filesystem can deal with receiving S_IFDIR from the vfs
before we enforce a non-zero type.
It is useful to do this clean-up ahead of O_CREAT|O_DIRECTORY.
Specifically, in lookup_open() we need to replace the vfs_prepare_mode()
with something that also handles dirs. I don't really want to push the
odd
mode = vfs_prepare_mode(idmap, dir, mode, S_IRWXUGO | S_ISVTX, 0);
further into that code, and neither do I want this to be different from
the regular vfs_mkdir() path. We can then also match on S_IFMT in
may_o_create(), instead of passing a bool to signal whether we are
creating a dir (and assuming 0 means a dir is really ugly).
It is a bit challenging to verify that passing S_IFDIR is safe, as there
are many filesystems. Claude Opus 4.8 was used to generate the context
for each mkdir implementation from which it can be judged whether
passing S_IFDIR is OK. The result was then verified by hand by looking
at how the mode argument is used in each case. To check whether all
mkdir implementations are covered, 'rg "\.mkdir" ' was used and checked
against the list of uses Claude found.
It is safe to do this clean-up except that three filesystems (fuse,
cifs, and coda) forward the mkdir @mode unchanged to something outside
the kernel. Mask S_IFDIR back out in coda_mkdir(), fuse_mkdir() and
cifs_mkdir() so that what is sent outside the kernel is unchanged.
Their maintainers can drop the mask once they have confirmed it is safe.
For the other filesystems redundant S_IFDIR OR'ing is dropped.
Jori Koolstra (31):
vfs: pass S_IFDIR mode to vfs_prepare_mode()
9p: drop redundant S_IFDIR from mkdir
affs: drop redundant S_IFDIR from mkdir
afs: drop redundant S_IFDIR from mkdir
autofs: drop redundant S_IFDIR from mkdir
btrfs: drop redundant S_IFDIR from mkdir
ceph: drop redundant S_IFDIR from mkdir
ext2: drop redundant S_IFDIR from mkdir
ext4: drop redundant S_IFDIR from mkdir
f2fs: drop redundant S_IFDIR from mkdir
gfs2: drop redundant S_IFDIR from mkdir
hfs: drop redundant S_IFDIR from mkdir
hfsplus: drop redundant S_IFDIR from mkdir
hpfs: drop redundant S_IFDIR from mkdir
hugetlbfs: drop redundant S_IFDIR from mkdir
jffs2: drop redundant S_IFDIR from mkdir
jfs: drop redundant S_IFDIR from mkdir
minix: drop redundant S_IFDIR from mkdir
nilfs2: drop redundant S_IFDIR from mkdir
ntfs3: drop redundant S_IFDIR from mkdir
ocfs2: drop redundant S_IFDIR from mkdir
ocfs2: dlmfs: drop redundant S_IFDIR from mkdir
omfs: drop redundant S_IFDIR from mkdir
orangefs: drop redundant S_IFDIR from mkdir
ramfs: drop redundant S_IFDIR from mkdir
udf: drop redundant S_IFDIR from mkdir
ufs: drop redundant S_IFDIR from mkdir
nfs: drop redundant S_IFDIR from mkdir
ubifs: drop redundant S_IFDIR from mkdir
xfs: drop redundant S_IFDIR from mkdir
ntfs: drop redundant S_IFDIR from mkdir
fs/9p/vfs_inode.c | 2 +-
fs/9p/vfs_inode_dotl.c | 1 -
fs/affs/namei.c | 2 +-
fs/afs/dir.c | 2 +-
fs/autofs/root.c | 2 +-
fs/btrfs/inode.c | 2 +-
fs/ceph/dir.c | 1 -
fs/coda/dir.c | 7 ++++++-
fs/ext2/namei.c | 2 +-
fs/ext4/namei.c | 2 +-
fs/f2fs/namei.c | 2 +-
fs/fuse/dir.c | 8 ++++++++
fs/gfs2/inode.c | 2 +-
fs/hfs/dir.c | 2 +-
fs/hfsplus/dir.c | 2 +-
fs/hpfs/namei.c | 4 ++--
fs/hugetlbfs/inode.c | 2 +-
fs/jffs2/dir.c | 2 --
fs/jfs/namei.c | 2 +-
fs/minix/namei.c | 2 +-
fs/namei.c | 7 +------
fs/nfs/dir.c | 2 +-
fs/nilfs2/namei.c | 2 +-
fs/ntfs/namei.c | 2 +-
fs/ntfs3/namei.c | 2 +-
fs/ocfs2/dlmfs/dlmfs.c | 2 +-
fs/ocfs2/namei.c | 2 +-
fs/omfs/dir.c | 2 +-
fs/orangefs/namei.c | 2 +-
fs/ramfs/inode.c | 2 +-
fs/smb/client/inode.c | 7 +++++++
fs/ubifs/dir.c | 2 +-
fs/udf/namei.c | 2 +-
fs/ufs/namei.c | 2 +-
fs/xfs/xfs_iops.c | 2 +-
35 files changed, 51 insertions(+), 40 deletions(-)
base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 01/31] vfs: pass S_IFDIR mode to vfs_prepare_mode()
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-07-01 10:08 ` Jan Kara
2026-06-30 10:53 ` [PATCH v2 02/31] 9p: drop redundant S_IFDIR from mkdir Jori Koolstra
` (31 subsequent siblings)
32 siblings, 1 reply; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
There is a comment in vfs_prepare_mode() that says:
Note that it's currently valid for @type to be 0 if a directory is
created. Filesystems raise that flag individually and we need to check
whether each filesystem can deal with receiving S_IFDIR from the vfs
before we enforce a non-zero type.
It is safe to do this clean-up except that three filesystems (fuse,
cifs, and coda) forward the mkdir @mode unchanged to something outside
the kernel. Mask S_IFDIR back out in coda_mkdir(), fuse_mkdir() and
cifs_mkdir() so that what is sent outside the kernel is unchanged.
Their maintainers can drop the mask once they have confirmed it is safe.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/coda/dir.c | 7 ++++++-
fs/fuse/dir.c | 8 ++++++++
fs/namei.c | 7 +------
fs/smb/client/inode.c | 7 +++++++
4 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index 835eb7fdfdad..9ad4d217c8b6 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -179,7 +179,12 @@ static struct dentry *coda_mkdir(struct mnt_idmap *idmap, struct inode *dir,
if (is_root_inode(dir) && coda_iscontrol(name, len))
return ERR_PTR(-EPERM);
- attrs.va_mode = mode;
+ /*
+ * vfs_mkdir() now passes S_IFDIR in @mode, but @mode is forwarded
+ * verbatim to userspace, which has only ever been given the permission
+ * bits. Strip the type bit until venus is known to cope with it.
+ */
+ attrs.va_mode = mode & ~S_IFDIR;
error = venus_mkdir(dir->i_sb, coda_i2f(dir),
name, len, &newfid, &attrs);
if (error)
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 0e2a1039fa43..7decbe4ea48a 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -1117,6 +1117,14 @@ static struct dentry *fuse_mkdir(struct mnt_idmap *idmap, struct inode *dir,
if (!fm->fc->dont_mask)
mode &= ~current_umask();
+ /*
+ * vfs_mkdir() now passes S_IFDIR in @mode, but @mode is forwarded
+ * verbatim to the userspace server which has only ever been given the
+ * permission bits. Strip the type bit until the protocol is known to
+ * cope with it.
+ */
+ mode &= ~S_IFDIR;
+
memset(&inarg, 0, sizeof(inarg));
inarg.mode = mode;
inarg.umask = current_umask();
diff --git a/fs/namei.c b/fs/namei.c
index 5cc9f0f466b8..6554803d6903 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -4140,11 +4140,6 @@ EXPORT_SYMBOL(end_renaming);
* after setgid stripping allows the same ordering for both non-POSIX ACL and
* POSIX ACL supporting filesystems.
*
- * Note that it's currently valid for @type to be 0 if a directory is created.
- * Filesystems raise that flag individually and we need to check whether each
- * filesystem can deal with receiving S_IFDIR from the vfs before we enforce a
- * non-zero type.
- *
* Returns: mode to be passed to the filesystem
*/
static inline umode_t vfs_prepare_mode(struct mnt_idmap *idmap,
@@ -5256,7 +5251,7 @@ struct dentry *vfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
if (!dir->i_op->mkdir)
goto err;
- mode = vfs_prepare_mode(idmap, dir, mode, S_IRWXUGO | S_ISVTX, 0);
+ mode = vfs_prepare_mode(idmap, dir, mode, S_IRWXUGO | S_ISVTX, S_IFDIR);
error = security_inode_mkdir(dir, dentry, mode);
if (error)
goto err;
diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c
index 1dbcfd163ff0..369dfd56c1e6 100644
--- a/fs/smb/client/inode.c
+++ b/fs/smb/client/inode.c
@@ -2282,6 +2282,13 @@ struct dentry *cifs_mkdir(struct mnt_idmap *idmap, struct inode *inode,
const char *full_path;
void *page;
+ /*
+ * vfs_mkdir() now passes S_IFDIR in @mode, but @mode is forwarded
+ * verbatim to the server and in the past only contained permission
+ * bits. Strip the type bit until SMB is verified to deal with it.
+ */
+ mode &= ~S_IFDIR;
+
cifs_dbg(FYI, "In cifs_mkdir, mode = %04ho inode = 0x%p\n",
mode, inode);
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 02/31] 9p: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 01/31] " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 03/31] affs: " Jori Koolstra
` (30 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in v9fs_vfs_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/9p/vfs_inode.c | 2 +-
fs/9p/vfs_inode_dotl.c | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 5783d0336f96..8abc88a20f00 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -689,7 +689,7 @@ static struct dentry *v9fs_vfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
p9_debug(P9_DEBUG_VFS, "name %pd\n", dentry);
v9ses = v9fs_inode2v9ses(dir);
- perm = unixmode2p9mode(v9ses, mode | S_IFDIR);
+ perm = unixmode2p9mode(v9ses, mode);
fid = v9fs_create(v9ses, dir, dentry, NULL, perm, P9_OREAD);
if (IS_ERR(fid))
return ERR_CAST(fid);
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index f7396d20cb6c..92d065609a8d 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -362,7 +362,6 @@ static struct dentry *v9fs_vfs_mkdir_dotl(struct mnt_idmap *idmap,
p9_debug(P9_DEBUG_VFS, "name %pd\n", dentry);
v9ses = v9fs_inode2v9ses(dir);
- omode |= S_IFDIR;
if (dir->i_mode & S_ISGID)
omode |= S_ISGID;
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 03/31] affs: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 01/31] " Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 02/31] 9p: drop redundant S_IFDIR from mkdir Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 04/31] afs: " Jori Koolstra
` (29 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in affs_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/affs/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/affs/namei.c b/fs/affs/namei.c
index c3c6532da4b0..1a6b2492ab03 100644
--- a/fs/affs/namei.c
+++ b/fs/affs/namei.c
@@ -287,7 +287,7 @@ affs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
if (!inode)
return ERR_PTR(-ENOSPC);
- inode->i_mode = S_IFDIR | mode;
+ inode->i_mode = mode;
affs_mode_to_prot(inode);
inode->i_op = &affs_dir_inode_operations;
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 04/31] afs: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (2 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 03/31] affs: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 05/31] autofs: " Jori Koolstra
` (28 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in afs_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/afs/dir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index 498b99ccdf0e..3bff8731e67a 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -1323,7 +1323,7 @@ static struct dentry *afs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
op->file[0].modification = true;
op->file[0].update_ctime = true;
op->dentry = dentry;
- op->create.mode = S_IFDIR | mode;
+ op->create.mode = mode;
op->create.reason = afs_edit_dir_for_mkdir;
op->mtime = current_time(dir);
op->ops = &afs_mkdir_operation;
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 05/31] autofs: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (3 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 04/31] afs: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 06/31] btrfs: " Jori Koolstra
` (27 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in autofs_dir_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/autofs/root.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/autofs/root.c b/fs/autofs/root.c
index 186e960f1e23..b36439f4521e 100644
--- a/fs/autofs/root.c
+++ b/fs/autofs/root.c
@@ -741,7 +741,7 @@ static struct dentry *autofs_dir_mkdir(struct mnt_idmap *idmap,
autofs_del_active(dentry);
- inode = autofs_get_inode(dir->i_sb, S_IFDIR | mode);
+ inode = autofs_get_inode(dir->i_sb, mode);
if (!inode)
return ERR_PTR(-ENOMEM);
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 06/31] btrfs: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (4 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 05/31] autofs: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 07/31] ceph: " Jori Koolstra
` (26 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in btrfs_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/btrfs/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 272598f6ae77..c19f75cc3e7c 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6936,7 +6936,7 @@ static struct dentry *btrfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
inode = new_inode(dir->i_sb);
if (!inode)
return ERR_PTR(-ENOMEM);
- inode_init_owner(idmap, inode, dir, S_IFDIR | mode);
+ inode_init_owner(idmap, inode, dir, mode);
inode->i_op = &btrfs_dir_inode_operations;
inode->i_fop = &btrfs_dir_file_operations;
return ERR_PTR(btrfs_create_common(dir, dentry, inode));
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 07/31] ceph: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (5 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 06/31] btrfs: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 08/31] ext2: " Jori Koolstra
` (25 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in ceph_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/ceph/dir.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 27ce9e55e947..32a48550eacf 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -1142,7 +1142,6 @@ static struct dentry *ceph_mkdir(struct mnt_idmap *idmap, struct inode *dir,
goto out;
}
- mode |= S_IFDIR;
req->r_new_inode = ceph_new_inode(dir, dentry, &mode, &as_ctx);
if (IS_ERR(req->r_new_inode)) {
ret = ERR_CAST(req->r_new_inode);
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 08/31] ext2: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (6 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 07/31] ceph: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-07-01 10:09 ` Jan Kara
2026-06-30 10:53 ` [PATCH v2 09/31] ext4: " Jori Koolstra
` (24 subsequent siblings)
32 siblings, 1 reply; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in ext2_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/ext2/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index 0d09d22fe708..411fd09c3c7e 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -236,7 +236,7 @@ static struct dentry *ext2_mkdir(struct mnt_idmap * idmap,
inode_inc_link_count(dir);
- inode = ext2_new_inode(dir, S_IFDIR | mode, &dentry->d_name);
+ inode = ext2_new_inode(dir, mode, &dentry->d_name);
err = PTR_ERR(inode);
if (IS_ERR(inode))
goto out_dir;
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 09/31] ext4: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (7 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 08/31] ext2: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-07-01 10:09 ` Jan Kara
2026-06-30 10:53 ` [PATCH v2 10/31] f2fs: " Jori Koolstra
` (23 subsequent siblings)
32 siblings, 1 reply; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in ext4_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/ext4/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index cc49ae04a6f6..0992fe21b261 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -3009,7 +3009,7 @@ static struct dentry *ext4_mkdir(struct mnt_idmap *idmap, struct inode *dir,
credits = (EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3);
retry:
- inode = ext4_new_inode_start_handle(idmap, dir, S_IFDIR | mode,
+ inode = ext4_new_inode_start_handle(idmap, dir, mode,
&dentry->d_name,
0, NULL, EXT4_HT_DIR, credits);
handle = ext4_journal_current_handle();
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 10/31] f2fs: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (8 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 09/31] ext4: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 11/31] gfs2: " Jori Koolstra
` (22 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in f2fs_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/f2fs/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index cac03b8e91a1..592ef4ae59b0 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -742,7 +742,7 @@ static struct dentry *f2fs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
if (err)
return ERR_PTR(err);
- inode = f2fs_new_inode(idmap, dir, S_IFDIR | mode, NULL);
+ inode = f2fs_new_inode(idmap, dir, mode, NULL);
if (IS_ERR(inode))
return ERR_CAST(inode);
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 11/31] gfs2: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (9 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 10/31] f2fs: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 12/31] hfs: " Jori Koolstra
` (21 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in gfs2_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/gfs2/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 8a77794bbd4a..62926d8e997a 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -1351,7 +1351,7 @@ static struct dentry *gfs2_mkdir(struct mnt_idmap *idmap, struct inode *dir,
{
unsigned dsize = gfs2_max_stuffed_size(GFS2_I(dir));
- return ERR_PTR(gfs2_create_inode(dir, dentry, NULL, S_IFDIR | mode, 0, NULL, dsize, 0));
+ return ERR_PTR(gfs2_create_inode(dir, dentry, NULL, mode, 0, NULL, dsize, 0));
}
/**
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 12/31] hfs: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (10 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 11/31] gfs2: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 13/31] hfsplus: " Jori Koolstra
` (20 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in hfs_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/hfs/dir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c
index e13450bb933e..a7bb9009c5ee 100644
--- a/fs/hfs/dir.c
+++ b/fs/hfs/dir.c
@@ -219,7 +219,7 @@ static struct dentry *hfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
struct inode *inode;
int res;
- inode = hfs_new_inode(dir, &dentry->d_name, S_IFDIR | mode);
+ inode = hfs_new_inode(dir, &dentry->d_name, mode);
if (IS_ERR(inode))
return ERR_CAST(inode);
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 13/31] hfsplus: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (11 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 12/31] hfs: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 14/31] hpfs: " Jori Koolstra
` (19 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in hfsplus_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/hfsplus/dir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index 8bf6c7cdd9a8..ec74de68b35f 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -570,7 +570,7 @@ static int hfsplus_create(struct mnt_idmap *idmap, struct inode *dir,
static struct dentry *hfsplus_mkdir(struct mnt_idmap *idmap, struct inode *dir,
struct dentry *dentry, umode_t mode)
{
- return ERR_PTR(hfsplus_mknod(&nop_mnt_idmap, dir, dentry, mode | S_IFDIR, 0));
+ return ERR_PTR(hfsplus_mknod(&nop_mnt_idmap, dir, dentry, mode, 0));
}
static int hfsplus_rename(struct mnt_idmap *idmap,
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 14/31] hpfs: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (12 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 13/31] hfsplus: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 15/31] hugetlbfs: " Jori Koolstra
` (18 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in hpfs_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/hpfs/namei.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c
index 353e13a615f5..b57dee5a0660 100644
--- a/fs/hpfs/namei.c
+++ b/fs/hpfs/namei.c
@@ -105,10 +105,10 @@ static struct dentry *hpfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
if (!uid_eq(result->i_uid, current_fsuid()) ||
!gid_eq(result->i_gid, current_fsgid()) ||
- result->i_mode != (mode | S_IFDIR)) {
+ result->i_mode != mode) {
result->i_uid = current_fsuid();
result->i_gid = current_fsgid();
- result->i_mode = mode | S_IFDIR;
+ result->i_mode = mode;
hpfs_write_inode_nolock(result);
}
hpfs_update_directory_times(dir);
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 15/31] hugetlbfs: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (13 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 14/31] hpfs: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 16/31] jffs2: " Jori Koolstra
` (17 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in hugetlbfs_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/hugetlbfs/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 216e1a0dd0b2..154d9fa8ccd1 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -971,7 +971,7 @@ static struct dentry *hugetlbfs_mkdir(struct mnt_idmap *idmap, struct inode *dir
struct dentry *dentry, umode_t mode)
{
int retval = hugetlbfs_mknod(idmap, dir, dentry,
- mode | S_IFDIR, 0);
+ mode, 0);
if (!retval)
inc_nlink(dir);
return ERR_PTR(retval);
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 16/31] jffs2: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (14 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 15/31] hugetlbfs: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 17/31] jfs: " Jori Koolstra
` (16 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in jffs2_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/jffs2/dir.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c
index c4088c3b4ac0..2b86adcbd8f4 100644
--- a/fs/jffs2/dir.c
+++ b/fs/jffs2/dir.c
@@ -462,8 +462,6 @@ static struct dentry *jffs2_mkdir (struct mnt_idmap *idmap, struct inode *dir_i,
uint32_t alloclen;
int ret;
- mode |= S_IFDIR;
-
ri = jffs2_alloc_raw_inode();
if (!ri)
return ERR_PTR(-ENOMEM);
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 17/31] jfs: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (15 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 16/31] jffs2: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 18/31] minix: " Jori Koolstra
` (15 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in jfs_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/jfs/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index 442d62679262..9ce5b8ff91bf 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -223,7 +223,7 @@ static struct dentry *jfs_mkdir(struct mnt_idmap *idmap, struct inode *dip,
* block there while holding dtree page, so we allocate the inode &
* begin the transaction before we search the directory.
*/
- ip = ialloc(dip, S_IFDIR | mode);
+ ip = ialloc(dip, mode);
if (IS_ERR(ip)) {
rc = PTR_ERR(ip);
goto out2;
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 18/31] minix: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (16 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 17/31] jfs: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-07-01 10:09 ` Jan Kara
2026-06-30 10:53 ` [PATCH v2 19/31] nilfs2: " Jori Koolstra
` (14 subsequent siblings)
32 siblings, 1 reply; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in minix_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/minix/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/minix/namei.c b/fs/minix/namei.c
index 263e4ba8b1c8..19b03ee15c28 100644
--- a/fs/minix/namei.c
+++ b/fs/minix/namei.c
@@ -110,7 +110,7 @@ static struct dentry *minix_mkdir(struct mnt_idmap *idmap, struct inode *dir,
struct inode * inode;
int err;
- inode = minix_new_inode(dir, S_IFDIR | mode);
+ inode = minix_new_inode(dir, mode);
if (IS_ERR(inode))
return ERR_CAST(inode);
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 19/31] nilfs2: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (17 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 18/31] minix: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 20/31] ntfs3: " Jori Koolstra
` (13 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in nilfs_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/nilfs2/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c
index e2fe95de3d71..d7d4f4d9a4e8 100644
--- a/fs/nilfs2/namei.c
+++ b/fs/nilfs2/namei.c
@@ -231,7 +231,7 @@ static struct dentry *nilfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
inc_nlink(dir);
- inode = nilfs_new_inode(dir, S_IFDIR | mode);
+ inode = nilfs_new_inode(dir, mode);
err = PTR_ERR(inode);
if (IS_ERR(inode))
goto out_dir;
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 20/31] ntfs3: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (18 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 19/31] nilfs2: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 21/31] ocfs2: " Jori Koolstra
` (12 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in ntfs_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/ntfs3/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c
index c59de5f2fa97..c6efb488e48e 100644
--- a/fs/ntfs3/namei.c
+++ b/fs/ntfs3/namei.c
@@ -213,7 +213,7 @@ static struct dentry *ntfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
struct dentry *dentry, umode_t mode)
{
return ERR_PTR(ntfs_create_inode(idmap, dir, dentry, NULL,
- S_IFDIR | mode, 0, NULL, 0, NULL));
+ mode, 0, NULL, 0, NULL));
}
/*
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 21/31] ocfs2: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (19 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 20/31] ntfs3: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-07-01 10:12 ` Jan Kara
2026-06-30 10:53 ` [PATCH v2 22/31] ocfs2: dlmfs: " Jori Koolstra
` (11 subsequent siblings)
32 siblings, 1 reply; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in ocfs2_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/ocfs2/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 1277666c77cd..b87eb6a2fa38 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -657,7 +657,7 @@ static struct dentry *ocfs2_mkdir(struct mnt_idmap *idmap,
trace_ocfs2_mkdir(dir, dentry, dentry->d_name.len, dentry->d_name.name,
OCFS2_I(dir)->ip_blkno, mode);
- ret = ocfs2_mknod(&nop_mnt_idmap, dir, dentry, mode | S_IFDIR, 0);
+ ret = ocfs2_mknod(&nop_mnt_idmap, dir, dentry, mode, 0);
if (ret)
mlog_errno(ret);
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 22/31] ocfs2: dlmfs: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (20 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 21/31] ocfs2: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-07-01 10:13 ` Jan Kara
2026-06-30 10:53 ` [PATCH v2 23/31] omfs: " Jori Koolstra
` (10 subsequent siblings)
32 siblings, 1 reply; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in dlmfs_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/ocfs2/dlmfs/dlmfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c
index 5821e33df78f..dc538fd8d9f8 100644
--- a/fs/ocfs2/dlmfs/dlmfs.c
+++ b/fs/ocfs2/dlmfs/dlmfs.c
@@ -422,7 +422,7 @@ static struct dentry *dlmfs_mkdir(struct mnt_idmap * idmap,
goto bail;
}
- inode = dlmfs_get_inode(dir, dentry, mode | S_IFDIR);
+ inode = dlmfs_get_inode(dir, dentry, mode);
if (!inode) {
status = -ENOMEM;
mlog_errno(status);
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 23/31] omfs: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (21 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 22/31] ocfs2: dlmfs: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 24/31] orangefs: " Jori Koolstra
` (9 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in omfs_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/omfs/dir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/omfs/dir.c b/fs/omfs/dir.c
index 2ed541fccf33..418906614f89 100644
--- a/fs/omfs/dir.c
+++ b/fs/omfs/dir.c
@@ -282,7 +282,7 @@ static int omfs_add_node(struct inode *dir, struct dentry *dentry, umode_t mode)
static struct dentry *omfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
struct dentry *dentry, umode_t mode)
{
- return ERR_PTR(omfs_add_node(dir, dentry, mode | S_IFDIR));
+ return ERR_PTR(omfs_add_node(dir, dentry, mode));
}
static int omfs_create(struct mnt_idmap *idmap, struct inode *dir,
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 24/31] orangefs: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (22 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 23/31] omfs: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 25/31] ramfs: " Jori Koolstra
` (8 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in orangefs_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/orangefs/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/orangefs/namei.c b/fs/orangefs/namei.c
index 75e65e72c2d6..22b4107b8dc0 100644
--- a/fs/orangefs/namei.c
+++ b/fs/orangefs/namei.c
@@ -333,7 +333,7 @@ static struct dentry *orangefs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
ref = new_op->downcall.resp.mkdir.refn;
- inode = orangefs_new_inode(dir->i_sb, dir, S_IFDIR | mode, 0, &ref);
+ inode = orangefs_new_inode(dir->i_sb, dir, mode, 0, &ref);
if (IS_ERR(inode)) {
gossip_err("*** Failed to allocate orangefs dir inode\n");
ret = PTR_ERR(inode);
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 25/31] ramfs: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (23 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 24/31] orangefs: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-07-01 10:10 ` Jan Kara
2026-06-30 10:53 ` [PATCH v2 26/31] udf: " Jori Koolstra
` (7 subsequent siblings)
32 siblings, 1 reply; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in ramfs_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/ramfs/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index 3987639ed132..e884ebc58a33 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -121,7 +121,7 @@ ramfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
static struct dentry *ramfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
struct dentry *dentry, umode_t mode)
{
- int retval = ramfs_mknod(&nop_mnt_idmap, dir, dentry, mode | S_IFDIR, 0);
+ int retval = ramfs_mknod(&nop_mnt_idmap, dir, dentry, mode, 0);
if (!retval)
inc_nlink(dir);
return ERR_PTR(retval);
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 26/31] udf: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (24 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 25/31] ramfs: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-07-01 10:10 ` Jan Kara
2026-06-30 10:53 ` [PATCH v2 27/31] ufs: " Jori Koolstra
` (6 subsequent siblings)
32 siblings, 1 reply; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in udf_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/udf/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index 9a3b7cef3606..849762a7d14e 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -428,7 +428,7 @@ static struct dentry *udf_mkdir(struct mnt_idmap *idmap, struct inode *dir,
struct udf_inode_info *dinfo = UDF_I(dir);
struct udf_inode_info *iinfo;
- inode = udf_new_inode(dir, S_IFDIR | mode);
+ inode = udf_new_inode(dir, mode);
if (IS_ERR(inode))
return ERR_CAST(inode);
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 27/31] ufs: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (25 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 26/31] udf: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 28/31] nfs: " Jori Koolstra
` (5 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in ufs_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/ufs/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c
index 5b3c85c93242..718e96506532 100644
--- a/fs/ufs/namei.c
+++ b/fs/ufs/namei.c
@@ -174,7 +174,7 @@ static struct dentry *ufs_mkdir(struct mnt_idmap * idmap, struct inode * dir,
inode_inc_link_count(dir);
- inode = ufs_new_inode(dir, S_IFDIR|mode);
+ inode = ufs_new_inode(dir, mode);
err = PTR_ERR(inode);
if (IS_ERR(inode))
goto out_dir;
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 28/31] nfs: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (26 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 27/31] ufs: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 29/31] ubifs: " Jori Koolstra
` (4 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in nfs_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/nfs/dir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index c7b723c18620..630718739d59 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -2474,7 +2474,7 @@ struct dentry *nfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
dir->i_sb->s_id, dir->i_ino, dentry);
attr.ia_valid = ATTR_MODE;
- attr.ia_mode = mode | S_IFDIR;
+ attr.ia_mode = mode;
trace_nfs_mkdir_enter(dir, dentry);
ret = NFS_PROTO(dir)->mkdir(dir, dentry, &attr);
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 29/31] ubifs: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (27 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 28/31] nfs: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 30/31] xfs: " Jori Koolstra
` (3 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in ubifs_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/ubifs/dir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 86d41e077e4d..b200f3d682b6 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -1031,7 +1031,7 @@ static struct dentry *ubifs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
sz_change = CALC_DENT_SIZE(fname_len(&nm));
- inode = ubifs_new_inode(c, dir, S_IFDIR | mode, false);
+ inode = ubifs_new_inode(c, dir, mode, false);
if (IS_ERR(inode)) {
err = PTR_ERR(inode);
goto out_fname;
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 30/31] xfs: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (28 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 29/31] ubifs: " Jori Koolstra
@ 2026-06-30 10:53 ` Jori Koolstra
2026-06-30 10:54 ` [PATCH v2 31/31] ntfs: " Jori Koolstra
` (2 subsequent siblings)
32 siblings, 0 replies; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:53 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in xfs_vn_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/xfs/xfs_iops.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 6339f4956ecb..a3c02101ff3f 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -306,7 +306,7 @@ xfs_vn_mkdir(
struct dentry *dentry,
umode_t mode)
{
- return ERR_PTR(xfs_generic_create(idmap, dir, dentry, mode | S_IFDIR, 0, NULL));
+ return ERR_PTR(xfs_generic_create(idmap, dir, dentry, mode, 0, NULL));
}
STATIC struct dentry *
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* [PATCH v2 31/31] ntfs: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (29 preceding siblings ...)
2026-06-30 10:53 ` [PATCH v2 30/31] xfs: " Jori Koolstra
@ 2026-06-30 10:54 ` Jori Koolstra
2026-06-30 22:37 ` [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() NeilBrown
2026-07-01 10:51 ` Christian Brauner
32 siblings, 0 replies; 45+ messages in thread
From: Jori Koolstra @ 2026-06-30 10:54 UTC (permalink / raw)
To: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara
Cc: linux-fsdevel, linux-kernel, Jori Koolstra
vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
->mkdir(), so OR-ing S_IFDIR into the mode again in ntfs_mkdir() is
redundant. Drop it.
Assisted-by: Claude Opus 4.8 (1M context)
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
fs/ntfs/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ntfs/namei.c b/fs/ntfs/namei.c
index a19626a135bd..ef4c52b2b7b9 100644
--- a/fs/ntfs/namei.c
+++ b/fs/ntfs/namei.c
@@ -1082,7 +1082,7 @@ static struct dentry *ntfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
if (!(vol->vol_flags & VOLUME_IS_DIRTY))
ntfs_set_volume_flags(vol, VOLUME_IS_DIRTY);
- ni = __ntfs_create(idmap, dir, uname, uname_len, S_IFDIR | mode, 0, NULL, 0);
+ ni = __ntfs_create(idmap, dir, uname, uname_len, mode, 0, NULL, 0);
kmem_cache_free(ntfs_name_cache, uname);
if (IS_ERR(ni)) {
err = PTR_ERR(ni);
--
2.54.0
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode()
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (30 preceding siblings ...)
2026-06-30 10:54 ` [PATCH v2 31/31] ntfs: " Jori Koolstra
@ 2026-06-30 22:37 ` NeilBrown
2026-07-01 11:04 ` Jori Koolstra
2026-07-01 10:51 ` Christian Brauner
32 siblings, 1 reply; 45+ messages in thread
From: NeilBrown @ 2026-06-30 22:37 UTC (permalink / raw)
To: Jori Koolstra
Cc: Christian Brauner, Alexander Viro, Jan Kara, linux-fsdevel,
linux-kernel, Jori Koolstra
On Tue, 30 Jun 2026, Jori Koolstra wrote:
> There is a comment in vfs_prepare_mode() that says:
>
> Note that it's currently valid for @type to be 0 if a directory is
> created. Filesystems raise that flag individually and we need to check
> whether each filesystem can deal with receiving S_IFDIR from the vfs
> before we enforce a non-zero type.
>
> It is useful to do this clean-up ahead of O_CREAT|O_DIRECTORY.
> Specifically, in lookup_open() we need to replace the vfs_prepare_mode()
> with something that also handles dirs. I don't really want to push the
> odd
>
> mode = vfs_prepare_mode(idmap, dir, mode, S_IRWXUGO | S_ISVTX, 0);
>
> further into that code, and neither do I want this to be different from
> the regular vfs_mkdir() path. We can then also match on S_IFMT in
> may_o_create(), instead of passing a bool to signal whether we are
> creating a dir (and assuming 0 means a dir is really ugly).
>
> It is a bit challenging to verify that passing S_IFDIR is safe, as there
> are many filesystems. Claude Opus 4.8 was used to generate the context
> for each mkdir implementation from which it can be judged whether
> passing S_IFDIR is OK. The result was then verified by hand by looking
> at how the mode argument is used in each case. To check whether all
> mkdir implementations are covered, 'rg "\.mkdir" ' was used and checked
> against the list of uses Claude found.
>
> It is safe to do this clean-up except that three filesystems (fuse,
> cifs, and coda) forward the mkdir @mode unchanged to something outside
> the kernel. Mask S_IFDIR back out in coda_mkdir(), fuse_mkdir() and
> cifs_mkdir() so that what is sent outside the kernel is unchanged.
> Their maintainers can drop the mask once they have confirmed it is safe.
> For the other filesystems redundant S_IFDIR OR'ing is dropped.
This all looks good to me - thanks.
Reviewed-by: NeilBrown <neil@brown.name>
NeilBrown
>
> Jori Koolstra (31):
> vfs: pass S_IFDIR mode to vfs_prepare_mode()
> 9p: drop redundant S_IFDIR from mkdir
> affs: drop redundant S_IFDIR from mkdir
> afs: drop redundant S_IFDIR from mkdir
> autofs: drop redundant S_IFDIR from mkdir
> btrfs: drop redundant S_IFDIR from mkdir
> ceph: drop redundant S_IFDIR from mkdir
> ext2: drop redundant S_IFDIR from mkdir
> ext4: drop redundant S_IFDIR from mkdir
> f2fs: drop redundant S_IFDIR from mkdir
> gfs2: drop redundant S_IFDIR from mkdir
> hfs: drop redundant S_IFDIR from mkdir
> hfsplus: drop redundant S_IFDIR from mkdir
> hpfs: drop redundant S_IFDIR from mkdir
> hugetlbfs: drop redundant S_IFDIR from mkdir
> jffs2: drop redundant S_IFDIR from mkdir
> jfs: drop redundant S_IFDIR from mkdir
> minix: drop redundant S_IFDIR from mkdir
> nilfs2: drop redundant S_IFDIR from mkdir
> ntfs3: drop redundant S_IFDIR from mkdir
> ocfs2: drop redundant S_IFDIR from mkdir
> ocfs2: dlmfs: drop redundant S_IFDIR from mkdir
> omfs: drop redundant S_IFDIR from mkdir
> orangefs: drop redundant S_IFDIR from mkdir
> ramfs: drop redundant S_IFDIR from mkdir
> udf: drop redundant S_IFDIR from mkdir
> ufs: drop redundant S_IFDIR from mkdir
> nfs: drop redundant S_IFDIR from mkdir
> ubifs: drop redundant S_IFDIR from mkdir
> xfs: drop redundant S_IFDIR from mkdir
> ntfs: drop redundant S_IFDIR from mkdir
>
> fs/9p/vfs_inode.c | 2 +-
> fs/9p/vfs_inode_dotl.c | 1 -
> fs/affs/namei.c | 2 +-
> fs/afs/dir.c | 2 +-
> fs/autofs/root.c | 2 +-
> fs/btrfs/inode.c | 2 +-
> fs/ceph/dir.c | 1 -
> fs/coda/dir.c | 7 ++++++-
> fs/ext2/namei.c | 2 +-
> fs/ext4/namei.c | 2 +-
> fs/f2fs/namei.c | 2 +-
> fs/fuse/dir.c | 8 ++++++++
> fs/gfs2/inode.c | 2 +-
> fs/hfs/dir.c | 2 +-
> fs/hfsplus/dir.c | 2 +-
> fs/hpfs/namei.c | 4 ++--
> fs/hugetlbfs/inode.c | 2 +-
> fs/jffs2/dir.c | 2 --
> fs/jfs/namei.c | 2 +-
> fs/minix/namei.c | 2 +-
> fs/namei.c | 7 +------
> fs/nfs/dir.c | 2 +-
> fs/nilfs2/namei.c | 2 +-
> fs/ntfs/namei.c | 2 +-
> fs/ntfs3/namei.c | 2 +-
> fs/ocfs2/dlmfs/dlmfs.c | 2 +-
> fs/ocfs2/namei.c | 2 +-
> fs/omfs/dir.c | 2 +-
> fs/orangefs/namei.c | 2 +-
> fs/ramfs/inode.c | 2 +-
> fs/smb/client/inode.c | 7 +++++++
> fs/ubifs/dir.c | 2 +-
> fs/udf/namei.c | 2 +-
> fs/ufs/namei.c | 2 +-
> fs/xfs/xfs_iops.c | 2 +-
> 35 files changed, 51 insertions(+), 40 deletions(-)
>
>
> base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482
> --
> 2.54.0
>
>
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH v2 01/31] vfs: pass S_IFDIR mode to vfs_prepare_mode()
2026-06-30 10:53 ` [PATCH v2 01/31] " Jori Koolstra
@ 2026-07-01 10:08 ` Jan Kara
0 siblings, 0 replies; 45+ messages in thread
From: Jan Kara @ 2026-07-01 10:08 UTC (permalink / raw)
To: Jori Koolstra
Cc: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara,
linux-fsdevel, linux-kernel
On Tue 30-06-26 12:53:30, Jori Koolstra wrote:
> There is a comment in vfs_prepare_mode() that says:
>
> Note that it's currently valid for @type to be 0 if a directory is
> created. Filesystems raise that flag individually and we need to check
> whether each filesystem can deal with receiving S_IFDIR from the vfs
> before we enforce a non-zero type.
>
> It is safe to do this clean-up except that three filesystems (fuse,
> cifs, and coda) forward the mkdir @mode unchanged to something outside
> the kernel. Mask S_IFDIR back out in coda_mkdir(), fuse_mkdir() and
> cifs_mkdir() so that what is sent outside the kernel is unchanged.
> Their maintainers can drop the mask once they have confirmed it is safe.
>
> Assisted-by: Claude Opus 4.8 (1M context)
> Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/coda/dir.c | 7 ++++++-
> fs/fuse/dir.c | 8 ++++++++
> fs/namei.c | 7 +------
> fs/smb/client/inode.c | 7 +++++++
> 4 files changed, 22 insertions(+), 7 deletions(-)
>
> diff --git a/fs/coda/dir.c b/fs/coda/dir.c
> index 835eb7fdfdad..9ad4d217c8b6 100644
> --- a/fs/coda/dir.c
> +++ b/fs/coda/dir.c
> @@ -179,7 +179,12 @@ static struct dentry *coda_mkdir(struct mnt_idmap *idmap, struct inode *dir,
> if (is_root_inode(dir) && coda_iscontrol(name, len))
> return ERR_PTR(-EPERM);
>
> - attrs.va_mode = mode;
> + /*
> + * vfs_mkdir() now passes S_IFDIR in @mode, but @mode is forwarded
> + * verbatim to userspace, which has only ever been given the permission
> + * bits. Strip the type bit until venus is known to cope with it.
> + */
> + attrs.va_mode = mode & ~S_IFDIR;
> error = venus_mkdir(dir->i_sb, coda_i2f(dir),
> name, len, &newfid, &attrs);
> if (error)
> diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
> index 0e2a1039fa43..7decbe4ea48a 100644
> --- a/fs/fuse/dir.c
> +++ b/fs/fuse/dir.c
> @@ -1117,6 +1117,14 @@ static struct dentry *fuse_mkdir(struct mnt_idmap *idmap, struct inode *dir,
> if (!fm->fc->dont_mask)
> mode &= ~current_umask();
>
> + /*
> + * vfs_mkdir() now passes S_IFDIR in @mode, but @mode is forwarded
> + * verbatim to the userspace server which has only ever been given the
> + * permission bits. Strip the type bit until the protocol is known to
> + * cope with it.
> + */
> + mode &= ~S_IFDIR;
> +
> memset(&inarg, 0, sizeof(inarg));
> inarg.mode = mode;
> inarg.umask = current_umask();
> diff --git a/fs/namei.c b/fs/namei.c
> index 5cc9f0f466b8..6554803d6903 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -4140,11 +4140,6 @@ EXPORT_SYMBOL(end_renaming);
> * after setgid stripping allows the same ordering for both non-POSIX ACL and
> * POSIX ACL supporting filesystems.
> *
> - * Note that it's currently valid for @type to be 0 if a directory is created.
> - * Filesystems raise that flag individually and we need to check whether each
> - * filesystem can deal with receiving S_IFDIR from the vfs before we enforce a
> - * non-zero type.
> - *
> * Returns: mode to be passed to the filesystem
> */
> static inline umode_t vfs_prepare_mode(struct mnt_idmap *idmap,
> @@ -5256,7 +5251,7 @@ struct dentry *vfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
> if (!dir->i_op->mkdir)
> goto err;
>
> - mode = vfs_prepare_mode(idmap, dir, mode, S_IRWXUGO | S_ISVTX, 0);
> + mode = vfs_prepare_mode(idmap, dir, mode, S_IRWXUGO | S_ISVTX, S_IFDIR);
> error = security_inode_mkdir(dir, dentry, mode);
> if (error)
> goto err;
> diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c
> index 1dbcfd163ff0..369dfd56c1e6 100644
> --- a/fs/smb/client/inode.c
> +++ b/fs/smb/client/inode.c
> @@ -2282,6 +2282,13 @@ struct dentry *cifs_mkdir(struct mnt_idmap *idmap, struct inode *inode,
> const char *full_path;
> void *page;
>
> + /*
> + * vfs_mkdir() now passes S_IFDIR in @mode, but @mode is forwarded
> + * verbatim to the server and in the past only contained permission
> + * bits. Strip the type bit until SMB is verified to deal with it.
> + */
> + mode &= ~S_IFDIR;
> +
> cifs_dbg(FYI, "In cifs_mkdir, mode = %04ho inode = 0x%p\n",
> mode, inode);
>
> --
> 2.54.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH v2 08/31] ext2: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 ` [PATCH v2 08/31] ext2: " Jori Koolstra
@ 2026-07-01 10:09 ` Jan Kara
0 siblings, 0 replies; 45+ messages in thread
From: Jan Kara @ 2026-07-01 10:09 UTC (permalink / raw)
To: Jori Koolstra
Cc: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara,
linux-fsdevel, linux-kernel
On Tue 30-06-26 12:53:37, Jori Koolstra wrote:
> vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
> ->mkdir(), so OR-ing S_IFDIR into the mode again in ext2_mkdir() is
> redundant. Drop it.
>
> Assisted-by: Claude Opus 4.8 (1M context)
> Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/ext2/namei.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
> index 0d09d22fe708..411fd09c3c7e 100644
> --- a/fs/ext2/namei.c
> +++ b/fs/ext2/namei.c
> @@ -236,7 +236,7 @@ static struct dentry *ext2_mkdir(struct mnt_idmap * idmap,
>
> inode_inc_link_count(dir);
>
> - inode = ext2_new_inode(dir, S_IFDIR | mode, &dentry->d_name);
> + inode = ext2_new_inode(dir, mode, &dentry->d_name);
> err = PTR_ERR(inode);
> if (IS_ERR(inode))
> goto out_dir;
> --
> 2.54.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH v2 09/31] ext4: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 ` [PATCH v2 09/31] ext4: " Jori Koolstra
@ 2026-07-01 10:09 ` Jan Kara
0 siblings, 0 replies; 45+ messages in thread
From: Jan Kara @ 2026-07-01 10:09 UTC (permalink / raw)
To: Jori Koolstra
Cc: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara,
linux-fsdevel, linux-kernel
On Tue 30-06-26 12:53:38, Jori Koolstra wrote:
> vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
> ->mkdir(), so OR-ing S_IFDIR into the mode again in ext4_mkdir() is
> redundant. Drop it.
>
> Assisted-by: Claude Opus 4.8 (1M context)
> Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/ext4/namei.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index cc49ae04a6f6..0992fe21b261 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -3009,7 +3009,7 @@ static struct dentry *ext4_mkdir(struct mnt_idmap *idmap, struct inode *dir,
> credits = (EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
> EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3);
> retry:
> - inode = ext4_new_inode_start_handle(idmap, dir, S_IFDIR | mode,
> + inode = ext4_new_inode_start_handle(idmap, dir, mode,
> &dentry->d_name,
> 0, NULL, EXT4_HT_DIR, credits);
> handle = ext4_journal_current_handle();
> --
> 2.54.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH v2 18/31] minix: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 ` [PATCH v2 18/31] minix: " Jori Koolstra
@ 2026-07-01 10:09 ` Jan Kara
0 siblings, 0 replies; 45+ messages in thread
From: Jan Kara @ 2026-07-01 10:09 UTC (permalink / raw)
To: Jori Koolstra
Cc: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara,
linux-fsdevel, linux-kernel
On Tue 30-06-26 12:53:47, Jori Koolstra wrote:
> vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
> ->mkdir(), so OR-ing S_IFDIR into the mode again in minix_mkdir() is
> redundant. Drop it.
>
> Assisted-by: Claude Opus 4.8 (1M context)
> Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/minix/namei.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/minix/namei.c b/fs/minix/namei.c
> index 263e4ba8b1c8..19b03ee15c28 100644
> --- a/fs/minix/namei.c
> +++ b/fs/minix/namei.c
> @@ -110,7 +110,7 @@ static struct dentry *minix_mkdir(struct mnt_idmap *idmap, struct inode *dir,
> struct inode * inode;
> int err;
>
> - inode = minix_new_inode(dir, S_IFDIR | mode);
> + inode = minix_new_inode(dir, mode);
> if (IS_ERR(inode))
> return ERR_CAST(inode);
>
> --
> 2.54.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH v2 25/31] ramfs: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 ` [PATCH v2 25/31] ramfs: " Jori Koolstra
@ 2026-07-01 10:10 ` Jan Kara
0 siblings, 0 replies; 45+ messages in thread
From: Jan Kara @ 2026-07-01 10:10 UTC (permalink / raw)
To: Jori Koolstra
Cc: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara,
linux-fsdevel, linux-kernel
On Tue 30-06-26 12:53:54, Jori Koolstra wrote:
> vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
> ->mkdir(), so OR-ing S_IFDIR into the mode again in ramfs_mkdir() is
> redundant. Drop it.
>
> Assisted-by: Claude Opus 4.8 (1M context)
> Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/ramfs/inode.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
> index 3987639ed132..e884ebc58a33 100644
> --- a/fs/ramfs/inode.c
> +++ b/fs/ramfs/inode.c
> @@ -121,7 +121,7 @@ ramfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
> static struct dentry *ramfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
> struct dentry *dentry, umode_t mode)
> {
> - int retval = ramfs_mknod(&nop_mnt_idmap, dir, dentry, mode | S_IFDIR, 0);
> + int retval = ramfs_mknod(&nop_mnt_idmap, dir, dentry, mode, 0);
> if (!retval)
> inc_nlink(dir);
> return ERR_PTR(retval);
> --
> 2.54.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH v2 26/31] udf: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 ` [PATCH v2 26/31] udf: " Jori Koolstra
@ 2026-07-01 10:10 ` Jan Kara
0 siblings, 0 replies; 45+ messages in thread
From: Jan Kara @ 2026-07-01 10:10 UTC (permalink / raw)
To: Jori Koolstra
Cc: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara,
linux-fsdevel, linux-kernel
On Tue 30-06-26 12:53:55, Jori Koolstra wrote:
> vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
> ->mkdir(), so OR-ing S_IFDIR into the mode again in udf_mkdir() is
> redundant. Drop it.
>
> Assisted-by: Claude Opus 4.8 (1M context)
> Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/udf/namei.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/udf/namei.c b/fs/udf/namei.c
> index 9a3b7cef3606..849762a7d14e 100644
> --- a/fs/udf/namei.c
> +++ b/fs/udf/namei.c
> @@ -428,7 +428,7 @@ static struct dentry *udf_mkdir(struct mnt_idmap *idmap, struct inode *dir,
> struct udf_inode_info *dinfo = UDF_I(dir);
> struct udf_inode_info *iinfo;
>
> - inode = udf_new_inode(dir, S_IFDIR | mode);
> + inode = udf_new_inode(dir, mode);
> if (IS_ERR(inode))
> return ERR_CAST(inode);
>
> --
> 2.54.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH v2 21/31] ocfs2: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 ` [PATCH v2 21/31] ocfs2: " Jori Koolstra
@ 2026-07-01 10:12 ` Jan Kara
0 siblings, 0 replies; 45+ messages in thread
From: Jan Kara @ 2026-07-01 10:12 UTC (permalink / raw)
To: Jori Koolstra
Cc: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara,
linux-fsdevel, linux-kernel
On Tue 30-06-26 12:53:50, Jori Koolstra wrote:
> vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
> ->mkdir(), so OR-ing S_IFDIR into the mode again in ocfs2_mkdir() is
> redundant. Drop it.
>
> Assisted-by: Claude Opus 4.8 (1M context)
> Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/ocfs2/namei.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
> index 1277666c77cd..b87eb6a2fa38 100644
> --- a/fs/ocfs2/namei.c
> +++ b/fs/ocfs2/namei.c
> @@ -657,7 +657,7 @@ static struct dentry *ocfs2_mkdir(struct mnt_idmap *idmap,
>
> trace_ocfs2_mkdir(dir, dentry, dentry->d_name.len, dentry->d_name.name,
> OCFS2_I(dir)->ip_blkno, mode);
> - ret = ocfs2_mknod(&nop_mnt_idmap, dir, dentry, mode | S_IFDIR, 0);
> + ret = ocfs2_mknod(&nop_mnt_idmap, dir, dentry, mode, 0);
> if (ret)
> mlog_errno(ret);
>
> --
> 2.54.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH v2 22/31] ocfs2: dlmfs: drop redundant S_IFDIR from mkdir
2026-06-30 10:53 ` [PATCH v2 22/31] ocfs2: dlmfs: " Jori Koolstra
@ 2026-07-01 10:13 ` Jan Kara
0 siblings, 0 replies; 45+ messages in thread
From: Jan Kara @ 2026-07-01 10:13 UTC (permalink / raw)
To: Jori Koolstra
Cc: Christian Brauner, NeilBrown, Alexander Viro, Jan Kara,
linux-fsdevel, linux-kernel
On Tue 30-06-26 12:53:51, Jori Koolstra wrote:
> vfs_mkdir() now sets the S_IFDIR type bit in the mode it passes to
> ->mkdir(), so OR-ing S_IFDIR into the mode again in dlmfs_mkdir() is
> redundant. Drop it.
>
> Assisted-by: Claude Opus 4.8 (1M context)
> Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/ocfs2/dlmfs/dlmfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c
> index 5821e33df78f..dc538fd8d9f8 100644
> --- a/fs/ocfs2/dlmfs/dlmfs.c
> +++ b/fs/ocfs2/dlmfs/dlmfs.c
> @@ -422,7 +422,7 @@ static struct dentry *dlmfs_mkdir(struct mnt_idmap * idmap,
> goto bail;
> }
>
> - inode = dlmfs_get_inode(dir, dentry, mode | S_IFDIR);
> + inode = dlmfs_get_inode(dir, dentry, mode);
> if (!inode) {
> status = -ENOMEM;
> mlog_errno(status);
> --
> 2.54.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode()
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
` (31 preceding siblings ...)
2026-06-30 22:37 ` [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() NeilBrown
@ 2026-07-01 10:51 ` Christian Brauner
2026-07-01 11:07 ` Jori Koolstra
32 siblings, 1 reply; 45+ messages in thread
From: Christian Brauner @ 2026-07-01 10:51 UTC (permalink / raw)
To: NeilBrown, Alexander Viro, Jan Kara, Jori Koolstra
Cc: linux-fsdevel, linux-kernel
On Tue, 30 Jun 2026 12:53:29 +0200, Jori Koolstra wrote:
> vfs: pass S_IFDIR mode to vfs_prepare_mode()
>
> There is a comment in vfs_prepare_mode() that says:
>
> Note that it's currently valid for @type to be 0 if a directory is
> created. Filesystems raise that flag individually and we need to check
> whether each filesystem can deal with receiving S_IFDIR from the vfs
> before we enforce a non-zero type.
>
> [...]
People are of course free to annotate their patches with Assisted-by
tags to point out that they are using an LLM. But I'm refusing to do
free in-kernel advertising for specific companies. So I've changed all
tags to read:
Assisted-by: LLM
which is good enough for all purposes. Nobody cares what specific sed or
coccinelle version or whatever else was used.
---
Applied to the vfs-7.3.misc branch of the vfs/vfs.git tree.
Patches in the vfs-7.3.misc branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-7.3.misc
[01/31] vfs: pass S_IFDIR mode to vfs_prepare_mode()
https://git.kernel.org/vfs/vfs/c/efdfa808046b
[02/31] 9p: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/cdece9964e85
[03/31] affs: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/a8b708c9854f
[04/31] afs: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/f5522bef1e46
[05/31] autofs: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/31468de07502
[06/31] btrfs: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/119ace91c0b6
[07/31] ceph: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/2a3471957fb2
[08/31] ext2: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/59d70c116933
[09/31] ext4: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/583b53b0b470
[10/31] f2fs: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/9822629e4207
[11/31] gfs2: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/cda6023f474b
[12/31] hfs: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/c9c0d511a820
[13/31] hfsplus: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/698ce0b15c50
[14/31] hpfs: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/e3ec849de731
[15/31] hugetlbfs: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/d6c1e7d1ddfe
[16/31] jffs2: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/2b8c9ca36328
[17/31] jfs: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/f6ad401d7f0c
[18/31] minix: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/3b4857471b66
[19/31] nilfs2: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/2183594ad607
[20/31] ntfs3: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/fc70a07e2702
[21/31] ocfs2: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/b12ec01ea00f
[22/31] ocfs2: dlmfs: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/840de92490a2
[23/31] omfs: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/2f2983204488
[24/31] orangefs: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/7643456f3468
[25/31] ramfs: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/86f91a68fb25
[26/31] udf: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/d36d77de05c1
[27/31] ufs: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/6449e995b4b2
[28/31] nfs: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/0266eafe7e34
[29/31] ubifs: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/9fc38090ccbc
[30/31] xfs: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/57162848e543
[31/31] ntfs: drop redundant S_IFDIR from mkdir
https://git.kernel.org/vfs/vfs/c/bec2272283f9
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode()
2026-06-30 22:37 ` [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() NeilBrown
@ 2026-07-01 11:04 ` Jori Koolstra
0 siblings, 0 replies; 45+ messages in thread
From: Jori Koolstra @ 2026-07-01 11:04 UTC (permalink / raw)
To: NeilBrown, NeilBrown
Cc: Christian Brauner, Alexander Viro, Jan Kara, linux-fsdevel, linux-kernel
> Op 01-07-2026 00:37 CEST schreef NeilBrown <neilb@ownmail.net>:
>
>
> On Tue, 30 Jun 2026, Jori Koolstra wrote:
> > There is a comment in vfs_prepare_mode() that says:
> >
> > Note that it's currently valid for @type to be 0 if a directory is
> > created. Filesystems raise that flag individually and we need to check
> > whether each filesystem can deal with receiving S_IFDIR from the vfs
> > before we enforce a non-zero type.
> >
> > It is useful to do this clean-up ahead of O_CREAT|O_DIRECTORY.
> > Specifically, in lookup_open() we need to replace the vfs_prepare_mode()
> > with something that also handles dirs. I don't really want to push the
> > odd
> >
> > mode = vfs_prepare_mode(idmap, dir, mode, S_IRWXUGO | S_ISVTX, 0);
> >
> > further into that code, and neither do I want this to be different from
> > the regular vfs_mkdir() path. We can then also match on S_IFMT in
> > may_o_create(), instead of passing a bool to signal whether we are
> > creating a dir (and assuming 0 means a dir is really ugly).
> >
> > It is a bit challenging to verify that passing S_IFDIR is safe, as there
> > are many filesystems. Claude Opus 4.8 was used to generate the context
> > for each mkdir implementation from which it can be judged whether
> > passing S_IFDIR is OK. The result was then verified by hand by looking
> > at how the mode argument is used in each case. To check whether all
> > mkdir implementations are covered, 'rg "\.mkdir" ' was used and checked
> > against the list of uses Claude found.
> >
> > It is safe to do this clean-up except that three filesystems (fuse,
> > cifs, and coda) forward the mkdir @mode unchanged to something outside
> > the kernel. Mask S_IFDIR back out in coda_mkdir(), fuse_mkdir() and
> > cifs_mkdir() so that what is sent outside the kernel is unchanged.
> > Their maintainers can drop the mask once they have confirmed it is safe.
> > For the other filesystems redundant S_IFDIR OR'ing is dropped.
>
> This all looks good to me - thanks.
> Reviewed-by: NeilBrown <neil@brown.name>
>
> NeilBrown
>
>
Thanks for the review, Neil.
By the way, if possible, would be great if we can get the excl flag removed
(as you mentioned) before the next merge window. Then the O_CREAT|O_DIRECTORY
stuff can use that clean-up as well (along with this) and maybe we can get
it all into 7.3.
Is it OK if I just go ahead and do that? But it is your observation, so feel free
to do it yourself whenever you have time, of course :)
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode()
2026-07-01 10:51 ` Christian Brauner
@ 2026-07-01 11:07 ` Jori Koolstra
2026-07-01 12:42 ` Christian Brauner
0 siblings, 1 reply; 45+ messages in thread
From: Jori Koolstra @ 2026-07-01 11:07 UTC (permalink / raw)
To: Christian Brauner
Cc: NeilBrown, Jan Kara, Alexander Viro, linux-fsdevel, linux-kernel
> Op 01-07-2026 12:51 CEST schreef Christian Brauner <brauner@kernel.org>:
>
>
> On Tue, 30 Jun 2026 12:53:29 +0200, Jori Koolstra wrote:
> > vfs: pass S_IFDIR mode to vfs_prepare_mode()
> >
> > There is a comment in vfs_prepare_mode() that says:
> >
> > Note that it's currently valid for @type to be 0 if a directory is
> > created. Filesystems raise that flag individually and we need to check
> > whether each filesystem can deal with receiving S_IFDIR from the vfs
> > before we enforce a non-zero type.
> >
> > [...]
>
> People are of course free to annotate their patches with Assisted-by
> tags to point out that they are using an LLM. But I'm refusing to do
> free in-kernel advertising for specific companies. So I've changed all
> tags to read:
>
> Assisted-by: LLM
>
> which is good enough for all purposes. Nobody cares what specific sed or
> coccinelle version or whatever else was used.
>
Oh, I actually much prefer that. Thanks for changing it. I was just following
https://docs.kernel.org/process/coding-assistants.html. Maybe that should be
updated...?
> ---
>
> Applied to the vfs-7.3.misc branch of the vfs/vfs.git tree.
> Patches in the vfs-7.3.misc branch should appear in linux-next soon.
>
> Please report any outstanding bugs that were missed during review in a
> new review to the original patch series allowing us to drop it.
>
> It's encouraged to provide Acked-bys and Reviewed-bys even though the
> patch has now been applied. If possible patch trailers will be updated.
>
> Note that commit hashes shown below are subject to change due to rebase,
> trailer updates or similar. If in doubt, please check the listed branch.
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
> branch: vfs-7.3.misc
>
> [01/31] vfs: pass S_IFDIR mode to vfs_prepare_mode()
> https://git.kernel.org/vfs/vfs/c/efdfa808046b
> [02/31] 9p: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/cdece9964e85
> [03/31] affs: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/a8b708c9854f
> [04/31] afs: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/f5522bef1e46
> [05/31] autofs: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/31468de07502
> [06/31] btrfs: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/119ace91c0b6
> [07/31] ceph: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/2a3471957fb2
> [08/31] ext2: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/59d70c116933
> [09/31] ext4: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/583b53b0b470
> [10/31] f2fs: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/9822629e4207
> [11/31] gfs2: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/cda6023f474b
> [12/31] hfs: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/c9c0d511a820
> [13/31] hfsplus: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/698ce0b15c50
> [14/31] hpfs: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/e3ec849de731
> [15/31] hugetlbfs: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/d6c1e7d1ddfe
> [16/31] jffs2: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/2b8c9ca36328
> [17/31] jfs: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/f6ad401d7f0c
> [18/31] minix: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/3b4857471b66
> [19/31] nilfs2: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/2183594ad607
> [20/31] ntfs3: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/fc70a07e2702
> [21/31] ocfs2: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/b12ec01ea00f
> [22/31] ocfs2: dlmfs: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/840de92490a2
> [23/31] omfs: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/2f2983204488
> [24/31] orangefs: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/7643456f3468
> [25/31] ramfs: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/86f91a68fb25
> [26/31] udf: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/d36d77de05c1
> [27/31] ufs: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/6449e995b4b2
> [28/31] nfs: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/0266eafe7e34
> [29/31] ubifs: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/9fc38090ccbc
> [30/31] xfs: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/57162848e543
> [31/31] ntfs: drop redundant S_IFDIR from mkdir
> https://git.kernel.org/vfs/vfs/c/bec2272283f9
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode()
2026-07-01 11:07 ` Jori Koolstra
@ 2026-07-01 12:42 ` Christian Brauner
0 siblings, 0 replies; 45+ messages in thread
From: Christian Brauner @ 2026-07-01 12:42 UTC (permalink / raw)
To: Jori Koolstra
Cc: Christian Brauner, NeilBrown, Jan Kara, Alexander Viro,
linux-fsdevel, linux-kernel
On 2026-07-01 13:07 +0200, Jori Koolstra wrote:
>
> > Op 01-07-2026 12:51 CEST schreef Christian Brauner <brauner@kernel.org>:
> >
> >
> > On Tue, 30 Jun 2026 12:53:29 +0200, Jori Koolstra wrote:
> > > vfs: pass S_IFDIR mode to vfs_prepare_mode()
> > >
> > > There is a comment in vfs_prepare_mode() that says:
> > >
> > > Note that it's currently valid for @type to be 0 if a directory is
> > > created. Filesystems raise that flag individually and we need to check
> > > whether each filesystem can deal with receiving S_IFDIR from the vfs
> > > before we enforce a non-zero type.
> > >
> > > [...]
> >
> > People are of course free to annotate their patches with Assisted-by
> > tags to point out that they are using an LLM. But I'm refusing to do
> > free in-kernel advertising for specific companies. So I've changed all
> > tags to read:
> >
> > Assisted-by: LLM
> >
> > which is good enough for all purposes. Nobody cares what specific sed or
> > coccinelle version or whatever else was used.
> >
>
> Oh, I actually much prefer that. Thanks for changing it. I was just following
> https://docs.kernel.org/process/coding-assistants.html. Maybe that should be
> updated...?
I have no appetite for reviving this endless discussion...
^ permalink raw reply [flat|nested] 45+ messages in thread
end of thread, other threads:[~2026-07-01 12:42 UTC | newest]
Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-30 10:53 [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 01/31] " Jori Koolstra
2026-07-01 10:08 ` Jan Kara
2026-06-30 10:53 ` [PATCH v2 02/31] 9p: drop redundant S_IFDIR from mkdir Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 03/31] affs: " Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 04/31] afs: " Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 05/31] autofs: " Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 06/31] btrfs: " Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 07/31] ceph: " Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 08/31] ext2: " Jori Koolstra
2026-07-01 10:09 ` Jan Kara
2026-06-30 10:53 ` [PATCH v2 09/31] ext4: " Jori Koolstra
2026-07-01 10:09 ` Jan Kara
2026-06-30 10:53 ` [PATCH v2 10/31] f2fs: " Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 11/31] gfs2: " Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 12/31] hfs: " Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 13/31] hfsplus: " Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 14/31] hpfs: " Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 15/31] hugetlbfs: " Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 16/31] jffs2: " Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 17/31] jfs: " Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 18/31] minix: " Jori Koolstra
2026-07-01 10:09 ` Jan Kara
2026-06-30 10:53 ` [PATCH v2 19/31] nilfs2: " Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 20/31] ntfs3: " Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 21/31] ocfs2: " Jori Koolstra
2026-07-01 10:12 ` Jan Kara
2026-06-30 10:53 ` [PATCH v2 22/31] ocfs2: dlmfs: " Jori Koolstra
2026-07-01 10:13 ` Jan Kara
2026-06-30 10:53 ` [PATCH v2 23/31] omfs: " Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 24/31] orangefs: " Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 25/31] ramfs: " Jori Koolstra
2026-07-01 10:10 ` Jan Kara
2026-06-30 10:53 ` [PATCH v2 26/31] udf: " Jori Koolstra
2026-07-01 10:10 ` Jan Kara
2026-06-30 10:53 ` [PATCH v2 27/31] ufs: " Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 28/31] nfs: " Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 29/31] ubifs: " Jori Koolstra
2026-06-30 10:53 ` [PATCH v2 30/31] xfs: " Jori Koolstra
2026-06-30 10:54 ` [PATCH v2 31/31] ntfs: " Jori Koolstra
2026-06-30 22:37 ` [PATCH v2 00/31] vfs: pass S_IFDIR mode to vfs_prepare_mode() NeilBrown
2026-07-01 11:04 ` Jori Koolstra
2026-07-01 10:51 ` Christian Brauner
2026-07-01 11:07 ` Jori Koolstra
2026-07-01 12:42 ` Christian Brauner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox