Message ID | 20231023184718.11143-1-bschubert@ddn.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [RFC] vfs: Convert BUG_ON to WARN_ON_ONCE in open_last_lookups | expand |
On Mon, 23 Oct 2023 20:47:18 +0200, Bernd Schubert wrote: > 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
diff --git a/fs/namei.c b/fs/namei.c index 94565bd7e73f..9ff8590ea0a7 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -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) {
The calling code actually handles -ECHILD, so this BUG_ON can be converted to WARN_ON_ONCE. Signed-off-by: Bernd Schubert <bschubert@ddn.com> Cc: Christian Brauner <brauner@kernel.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Amir Goldstein <amir73il@gmail.com> Cc: Dharmendra Singh <dsingh@ddn.com> Cc: Miklos Szeredi <miklos@szeredi.hu> Cc: linux-fsdevel@vger.kernel.org --- 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(-)