Skip to contentSkip to conversation

vfs: pass S_IFDIR mode to vfs_prepare_mode()

PATCH Applied Jori Koolstra 4 participants 45 messages Jun 30 – Jul 1

Subsystems (30)
lore
Share & tools
lore
#0 lore raw

v2 cover 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.

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

Signature · 1 line
2.54.0
#1 lore raw

PATCH v2 1/31 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.

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)
---
 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(-)
fs/coda/dir.c +6 -1
index 835eb7fdfdad..9ad4d217c8b6 100644
@@ -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)
fs/fuse/dir.c +8 -0
index 0e2a1039fa43..7decbe4ea48a 100644
@@ -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();
fs/namei.c +1 -6
index 5cc9f0f466b8..6554803d6903 100644
@@ -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;
fs/smb/client/inode.c +7 -0
index 1dbcfd163ff0..369dfd56c1e6 100644
@@ -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);
 
Signature · 1 line
2.54.0
reviewer Reviewed-by on v2 1/31
#2 lore raw
Quoted 7 lines · 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.

Quoted 8 lines

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)

Looks good. Feel free to add:

Honza

Quoted 90 lines
---
 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(-)
fs/coda/dir.c +6 -1
index 835eb7fdfdad..9ad4d217c8b6 100644
@@ -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)
fs/fuse/dir.c +8 -0
index 0e2a1039fa43..7decbe4ea48a 100644
@@ -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();
fs/namei.c +1 -6
index 5cc9f0f466b8..6554803d6903 100644
@@ -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;
fs/smb/client/inode.c +7 -0
index 1dbcfd163ff0..369dfd56c1e6 100644
@@ -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);
 
Signature · 1 line
2.54.0
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#3 lore raw

PATCH v2 2/31 9p: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/9p/vfs_inode.c      | 2 +-
 fs/9p/vfs_inode_dotl.c | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)
fs/9p/vfs_inode.c +1 -1
index 5783d0336f96..8abc88a20f00 100644
@@ -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);
fs/9p/vfs_inode_dotl.c +0 -1
index f7396d20cb6c..92d065609a8d 100644
@@ -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;
 
Signature · 1 line
2.54.0
#4 lore raw

PATCH v2 3/31 affs: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/affs/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/affs/namei.c +1 -1
index c3c6532da4b0..1a6b2492ab03 100644
@@ -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;
Signature · 1 line
2.54.0
#5 lore raw

PATCH v2 4/31 afs: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/afs/dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/afs/dir.c +1 -1
index 498b99ccdf0e..3bff8731e67a 100644
@@ -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;
Signature · 1 line
2.54.0
#6 lore raw

PATCH v2 5/31 autofs: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/autofs/root.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/autofs/root.c +1 -1
index 186e960f1e23..b36439f4521e 100644
@@ -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);
 
Signature · 1 line
2.54.0
#7 lore raw

PATCH v2 6/31 btrfs: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/btrfs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/inode.c +1 -1
index 272598f6ae77..c19f75cc3e7c 100644
@@ -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));
Signature · 1 line
2.54.0
#8 lore raw

PATCH v2 7/31 ceph: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/ceph/dir.c | 1 -
 1 file changed, 1 deletion(-)
fs/ceph/dir.c +0 -1
index 27ce9e55e947..32a48550eacf 100644
@@ -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);
Signature · 1 line
2.54.0
#9 lore raw

PATCH v2 8/31 ext2: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/ext2/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext2/namei.c +1 -1
index 0d09d22fe708..411fd09c3c7e 100644
@@ -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;
Signature · 1 line
2.54.0
reviewer Reviewed-by on v2 8/31
#10 lore raw

Re: [PATCH v2 08/31] ext2: drop redundant S_IFDIR from mkdir

Quoted 6 lines · 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)

Looks good. Feel free to add:

Honza

Quoted 20 lines
---
 fs/ext2/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext2/namei.c +1 -1
index 0d09d22fe708..411fd09c3c7e 100644
@@ -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;
Signature · 1 line
2.54.0
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#11 lore raw

PATCH v2 9/31 ext4: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/ext4/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/namei.c +1 -1
index cc49ae04a6f6..0992fe21b261 100644
@@ -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();
Signature · 1 line
2.54.0
reviewer Reviewed-by on v2 9/31
#12 lore raw

Re: [PATCH v2 09/31] ext4: drop redundant S_IFDIR from mkdir

Quoted 6 lines · 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)

Looks good. Feel free to add:

Honza

Quoted 20 lines
---
 fs/ext4/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/namei.c +1 -1
index cc49ae04a6f6..0992fe21b261 100644
@@ -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();
Signature · 1 line
2.54.0
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#13 lore raw

PATCH v2 10/31 f2fs: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/f2fs/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/namei.c +1 -1
index cac03b8e91a1..592ef4ae59b0 100644
@@ -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);
 
Signature · 1 line
2.54.0
#14 lore raw

PATCH v2 11/31 gfs2: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/gfs2/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/gfs2/inode.c +1 -1
index 8a77794bbd4a..62926d8e997a 100644
@@ -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));
 }
 
 /**
Signature · 1 line
2.54.0
#15 lore raw

PATCH v2 12/31 hfs: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/hfs/dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/hfs/dir.c +1 -1
index e13450bb933e..a7bb9009c5ee 100644
@@ -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);
 
Signature · 1 line
2.54.0
#16 lore raw

PATCH v2 13/31 hfsplus: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/hfsplus/dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/hfsplus/dir.c +1 -1
index 8bf6c7cdd9a8..ec74de68b35f 100644
@@ -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,
Signature · 1 line
2.54.0
#17 lore raw

PATCH v2 14/31 hpfs: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/hpfs/namei.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/hpfs/namei.c +2 -2
index 353e13a615f5..b57dee5a0660 100644
@@ -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);
Signature · 1 line
2.54.0
#18 lore raw

PATCH v2 15/31 hugetlbfs: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/hugetlbfs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/hugetlbfs/inode.c +1 -1
index 216e1a0dd0b2..154d9fa8ccd1 100644
@@ -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);
Signature · 1 line
2.54.0
#19 lore raw

PATCH v2 16/31 jffs2: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/jffs2/dir.c | 2 --
 1 file changed, 2 deletions(-)
fs/jffs2/dir.c +0 -2
index c4088c3b4ac0..2b86adcbd8f4 100644
@@ -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);
Signature · 1 line
2.54.0
#20 lore raw

PATCH v2 17/31 jfs: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/jfs/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jfs/namei.c +1 -1
index 442d62679262..9ce5b8ff91bf 100644
@@ -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;
Signature · 1 line
2.54.0
#21 lore raw

PATCH v2 18/31 minix: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/minix/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/minix/namei.c +1 -1
index 263e4ba8b1c8..19b03ee15c28 100644
@@ -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);
 
Signature · 1 line
2.54.0
reviewer Reviewed-by on v2 18/31
#22 lore raw

Re: [PATCH v2 18/31] minix: drop redundant S_IFDIR from mkdir

Quoted 6 lines · 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)

Looks good. Feel free to add:

Honza

Quoted 20 lines
---
 fs/minix/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/minix/namei.c +1 -1
index 263e4ba8b1c8..19b03ee15c28 100644
@@ -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);
 
Signature · 1 line
2.54.0
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#23 lore raw

PATCH v2 19/31 nilfs2: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/nilfs2/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nilfs2/namei.c +1 -1
index e2fe95de3d71..d7d4f4d9a4e8 100644
@@ -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;
Signature · 1 line
2.54.0
#24 lore raw

PATCH v2 20/31 ntfs3: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/ntfs3/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/namei.c +1 -1
index c59de5f2fa97..c6efb488e48e 100644
@@ -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));
 }
 
 /*
Signature · 1 line
2.54.0
#25 lore raw

PATCH v2 21/31 ocfs2: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/ocfs2/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/namei.c +1 -1
index 1277666c77cd..b87eb6a2fa38 100644
@@ -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);
 
Signature · 1 line
2.54.0
reviewer Reviewed-by on v2 21/31
#26 lore raw

Re: [PATCH v2 21/31] ocfs2: drop redundant S_IFDIR from mkdir

Quoted 6 lines · 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)

Looks good. Feel free to add:

Honza

Quoted 20 lines
---
 fs/ocfs2/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/namei.c +1 -1
index 1277666c77cd..b87eb6a2fa38 100644
@@ -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);
 
Signature · 1 line
2.54.0
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#27 lore raw

PATCH v2 22/31 ocfs2: dlmfs: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/ocfs2/dlmfs/dlmfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/dlmfs/dlmfs.c +1 -1
index 5821e33df78f..dc538fd8d9f8 100644
@@ -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);
Signature · 1 line
2.54.0
reviewer Reviewed-by on v2 22/31
#28 lore raw

Re: [PATCH v2 22/31] ocfs2: dlmfs: drop redundant S_IFDIR from mkdir

Quoted 6 lines · 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)

Looks good. Feel free to add:

Honza

Quoted 20 lines
---
 fs/ocfs2/dlmfs/dlmfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/dlmfs/dlmfs.c +1 -1
index 5821e33df78f..dc538fd8d9f8 100644
@@ -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);
Signature · 1 line
2.54.0
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#29 lore raw

PATCH v2 23/31 omfs: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/omfs/dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/omfs/dir.c +1 -1
index 2ed541fccf33..418906614f89 100644
@@ -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,
Signature · 1 line
2.54.0
#30 lore raw

PATCH v2 24/31 orangefs: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/orangefs/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/orangefs/namei.c +1 -1
index 75e65e72c2d6..22b4107b8dc0 100644
@@ -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);
Signature · 1 line
2.54.0
#31 lore raw

PATCH v2 25/31 ramfs: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/ramfs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ramfs/inode.c +1 -1
index 3987639ed132..e884ebc58a33 100644
@@ -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);
Signature · 1 line
2.54.0
reviewer Reviewed-by on v2 25/31
#32 lore raw

Re: [PATCH v2 25/31] ramfs: drop redundant S_IFDIR from mkdir

Quoted 6 lines · 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)

Looks good. Feel free to add:

Honza

Quoted 20 lines
---
 fs/ramfs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ramfs/inode.c +1 -1
index 3987639ed132..e884ebc58a33 100644
@@ -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);
Signature · 1 line
2.54.0
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#33 lore raw

PATCH v2 26/31 udf: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/udf/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/udf/namei.c +1 -1
index 9a3b7cef3606..849762a7d14e 100644
@@ -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);
 
Signature · 1 line
2.54.0
reviewer Reviewed-by on v2 26/31
#34 lore raw

Re: [PATCH v2 26/31] udf: drop redundant S_IFDIR from mkdir

Quoted 6 lines · 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)

Looks good. Feel free to add:

Honza

Quoted 20 lines
---
 fs/udf/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/udf/namei.c +1 -1
index 9a3b7cef3606..849762a7d14e 100644
@@ -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);
 
Signature · 1 line
2.54.0
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#35 lore raw

PATCH v2 27/31 ufs: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/ufs/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ufs/namei.c +1 -1
index 5b3c85c93242..718e96506532 100644
@@ -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;
Signature · 1 line
2.54.0
#36 lore raw

PATCH v2 28/31 nfs: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/nfs/dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/dir.c +1 -1
index c7b723c18620..630718739d59 100644
@@ -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);
Signature · 1 line
2.54.0
#37 lore raw

PATCH v2 29/31 ubifs: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/ubifs/dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ubifs/dir.c +1 -1
index 86d41e077e4d..b200f3d682b6 100644
@@ -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;
Signature · 1 line
2.54.0
#38 lore raw

PATCH v2 30/31 xfs: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/xfs/xfs_iops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_iops.c +1 -1
index 6339f4956ecb..a3c02101ff3f 100644
@@ -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 *
Signature · 1 line
2.54.0
#39 lore raw

PATCH v2 31/31 ntfs: drop redundant S_IFDIR from mkdir

In reply to 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)
---
 fs/ntfs/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs/namei.c +1 -1
index a19626a135bd..ef4c52b2b7b9 100644
@@ -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);
Signature · 1 line
2.54.0
Reviewed-by on the v2 series
#40 lore raw
In reply to Jori Koolstra
Quoted 27 lines · 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.

Quoted 6 lines

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.

NeilBrown

Quoted 77 lines

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

Signature · 1 line
2.54.0
#41 lore raw
Quoted 39 lines

Op 01-07-2026 00:37 CEST schreef NeilBrown <[email protected]>:

Quoted 27 lines · 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.

Quoted 6 lines

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.

Quoted 6 lines

This all looks good to me - thanks.

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 :)

maintainer Applied
#42 lore raw
In reply to Jori Koolstra
Quoted 10 lines · Jori Koolstra

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
#43 lore raw
Quoted 21 lines

Op 01-07-2026 12:51 CEST schreef Christian Brauner <[email protected]>:

Quoted 10 lines · Jori Koolstra

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:

Quoted 5 lines
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...?

Quoted 79 lines

---

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
#44 lore raw
Quoted 23 lines · Jori Koolstra
Quoted 23 lines

Op 01-07-2026 12:51 CEST schreef Christian Brauner <[email protected]>:

Quoted 10 lines · Jori Koolstra

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
Quoted 7 lines
Quoted 3 lines

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...