summaryrefslogtreecommitdiff
path: root/include/linux/bnge/git@git.tavy.me:linux.git
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2026-07-01 12:46:17 +0200
committerChristian Brauner <brauner@kernel.org>2026-07-01 12:51:27 +0200
commit9a4604068266815aa904e09a183139154f7ac06c (patch)
tree38756e5fbe6e26a25d2630f4bd9af5727bec66ae /include/linux/bnge/git@git.tavy.me:linux.git
parentaf695109e83085441d95e65d5e7795681b303500 (diff)
parenta380b9693c7a005806a7bf901f4a2be8b4395249 (diff)
Merge patch series "vfs: pass S_IFDIR mode to vfs_prepare_mode()"
Jori Koolstra <jkoolstra@xs4all.nl> says: 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. * patches from https://patch.msgid.link/20260630105400.68459-1-jkoolstra@xs4all.nl: (31 commits) ntfs: drop redundant S_IFDIR from mkdir xfs: drop redundant S_IFDIR from mkdir ubifs: drop redundant S_IFDIR from mkdir nfs: drop redundant S_IFDIR from mkdir ufs: drop redundant S_IFDIR from mkdir udf: drop redundant S_IFDIR from mkdir ramfs: drop redundant S_IFDIR from mkdir orangefs: drop redundant S_IFDIR from mkdir omfs: drop redundant S_IFDIR from mkdir ocfs2: dlmfs: drop redundant S_IFDIR from mkdir ocfs2: drop redundant S_IFDIR from mkdir ntfs3: drop redundant S_IFDIR from mkdir nilfs2: drop redundant S_IFDIR from mkdir minix: drop redundant S_IFDIR from mkdir jfs: drop redundant S_IFDIR from mkdir jffs2: drop redundant S_IFDIR from mkdir hugetlbfs: drop redundant S_IFDIR from mkdir hpfs: drop redundant S_IFDIR from mkdir hfsplus: drop redundant S_IFDIR from mkdir hfs: drop redundant S_IFDIR from mkdir ... Link: https://patch.msgid.link/20260630105400.68459-1-jkoolstra@xs4all.nl Suggested-by: Christian Brauner (Amutable) <brauner@kernel.org> Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'include/linux/bnge/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions