Skip to contentSkip to conversation

vfs: Convert BUG_ON to WARN_ON_ONCE in open_last_lookups

RFC PATCH Applied Bernd Schubert 2 participants 2 messages Oct 23, 2023 – Oct 24, 2023 VFS

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 vfs: Convert BUG_ON to WARN_ON_ONCE in open_last_lookups

The calling code actually handles -ECHILD, so this BUG_ON can be converted to WARN_ON_ONCE.

Cc Christian Brauner <[email protected]>
Cc Al Viro <[email protected]>
Cc Amir Goldstein <[email protected]>
Cc Dharmendra Singh <[email protected]>
Cc Miklos Szeredi <[email protected]>

---
This relates to the fuse atomic open patches and their vfs revalidate part. Amir had annotated that these patches had a BUG_ON, which I had only taken as a few lines below the there was the BUG_ON replaced in this patch.

---
 fs/namei.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/namei.c +2 -1
index 94565bd7e73f..9ff8590ea0a7 100644
@@ -3536,7 +3536,8 @@ static const char *open_last_lookups(struct nameidata *nd,
 		if (likely(dentry))
 			goto finish_lookup;
 
-		BUG_ON(nd->flags & LOOKUP_RCU);
+		if (WARN_ON_ONCE(nd->flags & LOOKUP_RCU))
+			return ERR_PTR(-ECHILD);
 	} else {
 		/* create side of things */
 		if (nd->flags & LOOKUP_RCU) {
Signature · 1 line
2.39.2
maintainer Applied
#1 lore raw
Quoted 4 lines · Bernd Schubert

The calling code actually handles -ECHILD, so this BUG_ON can be converted to WARN_ON_ONCE.

Applied to the vfs.misc branch of the vfs/vfs.git tree. Patches in the vfs.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.misc

[1/1] vfs: Convert BUG_ON to WARN_ON_ONCE in open_last_lookups

      https://git.kernel.org/vfs/vfs/c/c04d905f6c7c