get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2223147/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2223147,
    "url": "http://patchwork.ozlabs.org/api/patches/2223147/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260414143721.858743-1-pc@manguebit.org/",
    "project": {
        "id": 12,
        "url": "http://patchwork.ozlabs.org/api/projects/12/?format=api",
        "name": "Linux CIFS Client",
        "link_name": "linux-cifs-client",
        "list_id": "linux-cifs.vger.kernel.org",
        "list_email": "linux-cifs@vger.kernel.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260414143721.858743-1-pc@manguebit.org>",
    "list_archive_url": null,
    "date": "2026-04-14T14:37:21",
    "name": "vfs: get rid of BUG_ON() in d_mark_tmpfile_name()",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "a3ed77c3c33316b0e9b0af0f5d89817e8658d188",
    "submitter": {
        "id": 91025,
        "url": "http://patchwork.ozlabs.org/api/people/91025/?format=api",
        "name": "Paulo Alcantara",
        "email": "pc@manguebit.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260414143721.858743-1-pc@manguebit.org/mbox/",
    "series": [
        {
            "id": 499857,
            "url": "http://patchwork.ozlabs.org/api/series/499857/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-cifs-client/list/?series=499857",
            "date": "2026-04-14T14:37:21",
            "name": "vfs: get rid of BUG_ON() in d_mark_tmpfile_name()",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/499857/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2223147/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2223147/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linux-cifs+bounces-10810-incoming=patchwork.ozlabs.org@vger.kernel.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "linux-cifs@vger.kernel.org"
        ],
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=manguebit.org header.i=@manguebit.org header.a=rsa-sha256\n header.s=dkim header.b=52TnticL;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c09:e001:a7::12fc:5321; helo=sto.lore.kernel.org;\n envelope-from=linux-cifs+bounces-10810-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)",
            "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=manguebit.org header.i=@manguebit.org\n header.b=\"52TnticL\"",
            "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=143.255.12.172",
            "smtp.subspace.kernel.org;\n dmarc=pass (p=quarantine dis=none) header.from=manguebit.org",
            "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=manguebit.org"
        ],
        "Received": [
            "from sto.lore.kernel.org (sto.lore.kernel.org\n [IPv6:2600:3c09:e001:a7::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fw6Ln4HbKz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 15 Apr 2026 00:37:37 +1000 (AEST)",
            "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sto.lore.kernel.org (Postfix) with ESMTP id 3BF0A300E59F\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 14 Apr 2026 14:37:34 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 4E8B23E3144;\n\tTue, 14 Apr 2026 14:37:32 +0000 (UTC)",
            "from mx1.manguebit.org (mx1.manguebit.org [143.255.12.172])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 958793115AF;\n\tTue, 14 Apr 2026 14:37:30 +0000 (UTC)",
            "from pc by mx1.manguebit.org with local (Exim 4.99.1)\n\tid 1wCetH-000000009sy-1t1a;\n\tTue, 14 Apr 2026 11:37:23 -0300"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776177452; cv=none;\n b=Eyi8F678HsolDQBDr43UcbVHDd8Oi1V6r7pv73PDFjJzDkJBszVjb0gCKvVpRUKC9bgORrhpdQ1X/nk3H5Kyi3QaXDVBzJs6yIOu7LmcC+FiccK4NxVRy/9VSdgBpXQfjkwk8HpSeWXTYLrLVuQm6K8xaof8mk5kN4kcbQiAVd4=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776177452; c=relaxed/simple;\n\tbh=5RQ2BoHKBBLKbxf6m8wqphbNLkkIJ8MXTz6bhV2aqyw=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=H7DFUGhDNTTmKpdHT3BHrg5BnoswFpTqjodnntQRy7ufiBVjTQReundt7VpkOicXtG4FGtRTJQDJnM2zYezaCna0u6XSZYcK4noMa4h4QPF5oKPEzEp32thp+LIVBy2ODLtGFYoyaMhuq2y+FK0k11f6Ay5wSagBAENLsnegAKI=",
        "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=quarantine dis=none) header.from=manguebit.org;\n spf=pass smtp.mailfrom=manguebit.org;\n dkim=pass (2048-bit key) header.d=manguebit.org header.i=@manguebit.org\n header.b=52TnticL; arc=none smtp.client-ip=143.255.12.172",
        "DKIM-Signature": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=manguebit.org; s=dkim; h=Content-Transfer-Encoding:MIME-Version:Message-ID:\n\tDate:Subject:Cc:To:From:Sender:Content-Type:Reply-To:Content-ID:\n\tContent-Description:In-Reply-To:References;\n\tbh=J8x1aq6PSopvf/hXZfxwRUdDZpC5EfUzTLL7KcXdPyU=; b=52TnticLchLpV1ImUTXVktw8Wp\n\thHA4XTC5Bii4qtvF9XEELd9NE/c4Uo5Bb0rsKpQpU4BVd0fek4KtAKronBws70ScpgYHMmtR/N+du\n\tof8wjXZakhvkUB/ZgDQ8ODZtzdqMDO05QDY0QVNYv01+yZ/rVQ9O5/Z4FmZ7dsU5dx7rlicRpbQRZ\n\t9YeH9C4+E+NcWHCqS/h01zuRIR9JIkvTY6imhjk9EGBuJMoO41/mRHxgFybD2eqMHJcHUYbVasge+\n\ttoBd/HjiSX1i5OUzneBXKLQqY67dGLUuCwDuo5WFILIRA2xdtmcA8Zbe/ab5Nu7Yz2gq/v0VEy51T\n\t6QIhydXA==;",
        "From": "Paulo Alcantara <pc@manguebit.org>",
        "To": "Steve French <smfrench@gmail.com>,\n\tAl Viro <viro@zeniv.linux.org.uk>",
        "Cc": "Linus Torvalds <torvalds@linux-foundation.org>,\n\t\"Paulo Alcantara (Red Hat)\" <pc@manguebit.org>,\n\tDavid Howells <dhowells@redhat.com>,\n\tChristian Brauner <brauner@kernel.org>,\n\tJan Kara <jack@suse.cz>,\n\tlinux-fsdevel@vger.kernel.org,\n\tlinux-cifs@vger.kernel.org",
        "Subject": "[PATCH] vfs: get rid of BUG_ON() in d_mark_tmpfile_name()",
        "Date": "Tue, 14 Apr 2026 11:37:21 -0300",
        "Message-ID": "<20260414143721.858743-1-pc@manguebit.org>",
        "X-Mailer": "git-send-email 2.53.0",
        "Precedence": "bulk",
        "X-Mailing-List": "linux-cifs@vger.kernel.org",
        "List-Id": "<linux-cifs.vger.kernel.org>",
        "List-Subscribe": "<mailto:linux-cifs+subscribe@vger.kernel.org>",
        "List-Unsubscribe": "<mailto:linux-cifs+unsubscribe@vger.kernel.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit"
    },
    "content": "Do proper error handling in d_mark_tmpfile_name() by returning errors\nrather than using BUG_ON()'s.\n\nAdjust caller to check for errors from d_mark_tmpfile_name() as well\nas clean it up for using return value from scnprintf() in QSTR_LEN()\nto make it more obvious where the tmpfile name's length is coming\nfrom.\n\nLink: https://lore.kernel.org/r/CAHk-=wgerpUKCDhdzKH0FEdLyfhj3doc9t+kO9Yb6rSsTp7hdQ@mail.gmail.com\nSuggested-by: Linus Torvalds <torvalds@linux-foundation.org>\nSigned-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>\nCc: David Howells <dhowells@redhat.com>\nCc: Christian Brauner <brauner@kernel.org>\nCc: Jan Kara <jack@suse.cz>\nCC: linux-fsdevel@vger.kernel.org\nCc: linux-cifs@vger.kernel.org\n---\n fs/dcache.c            | 14 +++++++++-----\n fs/smb/client/cifsfs.h | 15 +++++----------\n fs/smb/client/dir.c    | 25 +++++++++++++++----------\n include/linux/dcache.h |  2 +-\n 4 files changed, 30 insertions(+), 26 deletions(-)",
    "diff": "diff --git a/fs/dcache.c b/fs/dcache.c\nindex df11bbba0342..dbcbd0affb26 100644\n--- a/fs/dcache.c\n+++ b/fs/dcache.c\n@@ -3196,15 +3196,18 @@ void d_mark_tmpfile(struct file *file, struct inode *inode)\n }\n EXPORT_SYMBOL(d_mark_tmpfile);\n \n-void d_mark_tmpfile_name(struct file *file, const struct qstr *name)\n+int d_mark_tmpfile_name(struct file *file, const struct qstr *name)\n {\n \tstruct dentry *dentry = file->f_path.dentry;\n \tchar *dname = dentry->d_shortname.string;\n \n-\tBUG_ON(dname_external(dentry));\n-\tBUG_ON(d_really_is_positive(dentry));\n-\tBUG_ON(!d_unlinked(dentry));\n-\tBUG_ON(name->len > DNAME_INLINE_LEN - 1);\n+\tif (unlikely(dname_external(dentry) ||\n+\t\t     d_really_is_positive(dentry) ||\n+\t\t     !d_unlinked(dentry)))\n+\t\treturn -EINVAL;\n+\tif (unlikely(name->len > DNAME_INLINE_LEN - 1))\n+\t\treturn -ENAMETOOLONG;\n+\n \tspin_lock(&dentry->d_parent->d_lock);\n \tspin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);\n \tdentry->__d_name.len = name->len;\n@@ -3212,6 +3215,7 @@ void d_mark_tmpfile_name(struct file *file, const struct qstr *name)\n \tdname[name->len] = '\\0';\n \tspin_unlock(&dentry->d_lock);\n \tspin_unlock(&dentry->d_parent->d_lock);\n+\treturn 0;\n }\n EXPORT_SYMBOL(d_mark_tmpfile_name);\n \ndiff --git a/fs/smb/client/cifsfs.h b/fs/smb/client/cifsfs.h\nindex 18f9f93a01b4..7370b38da938 100644\n--- a/fs/smb/client/cifsfs.h\n+++ b/fs/smb/client/cifsfs.h\n@@ -10,6 +10,7 @@\n #define _CIFSFS_H\n \n #include <linux/hash.h>\n+#include <linux/dcache.h>\n \n #define ROOT_I 2\n \n@@ -149,17 +150,11 @@ struct dentry *cifs_smb3_do_mount(struct file_system_type *fs_type, int flags,\n \n char *cifs_silly_fullpath(struct dentry *dentry);\n \n-#define CIFS_TMPNAME_PREFIX        \".__smbfile_tmp\"\n-#define CIFS_TMPNAME_PREFIX_LEN    ((int)sizeof(CIFS_TMPNAME_PREFIX) - 1)\n-#define CIFS_TMPNAME_COUNTER_LEN   ((int)sizeof(cifs_tmpcounter) * 2)\n-#define CIFS_TMPNAME_LEN \\\n-\t(CIFS_TMPNAME_PREFIX_LEN + CIFS_TMPNAME_COUNTER_LEN)\n+#define CIFS_TMPNAME_PREFIX\t\".__smbfile_tmp\"\n+#define CIFS_TMPNAME_LEN\t(DNAME_INLINE_LEN - 1)\n \n-#define CIFS_SILLYNAME_PREFIX\t    \".__smbfile_silly\"\n-#define CIFS_SILLYNAME_PREFIX_LEN  ((int)sizeof(CIFS_SILLYNAME_PREFIX) - 1)\n-#define CIFS_SILLYNAME_COUNTER_LEN ((int)sizeof(cifs_sillycounter) * 2)\n-#define CIFS_SILLYNAME_LEN \\\n-\t(CIFS_SILLYNAME_PREFIX_LEN + CIFS_SILLYNAME_COUNTER_LEN)\n+#define CIFS_SILLYNAME_PREFIX\t\".__smbfile_silly\"\n+#define CIFS_SILLYNAME_LEN\t(DNAME_INLINE_LEN - 1)\n \n #ifdef CONFIG_CIFS_NFSD_EXPORT\n extern const struct export_operations cifs_export_ops;\ndiff --git a/fs/smb/client/dir.c b/fs/smb/client/dir.c\nindex 6ea1ae7f7a46..e4295a5b55b3 100644\n--- a/fs/smb/client/dir.c\n+++ b/fs/smb/client/dir.c\n@@ -1056,9 +1056,9 @@ int cifs_tmpfile(struct mnt_idmap *idmap, struct inode *dir,\n {\n \tstruct dentry *dentry = file->f_path.dentry;\n \tstruct cifs_sb_info *cifs_sb = CIFS_SB(dir);\n+\tsize_t namesize = CIFS_TMPNAME_LEN + 1;\n \tchar *path __free(kfree) = NULL, *name;\n \tunsigned int oflags = file->f_flags;\n-\tsize_t size = CIFS_TMPNAME_LEN + 1;\n \tint retries = 0, max_retries = 16;\n \tstruct TCP_Server_Info *server;\n \tstruct cifs_pending_open open;\n@@ -1070,6 +1070,7 @@ int cifs_tmpfile(struct mnt_idmap *idmap, struct inode *dir,\n \tstruct inode *inode;\n \tunsigned int xid;\n \t__u32 oplock;\n+\tint namelen;\n \tint rc;\n \n \tif (unlikely(cifs_forced_shutdown(cifs_sb)))\n@@ -1093,7 +1094,7 @@ int cifs_tmpfile(struct mnt_idmap *idmap, struct inode *dir,\n \t\tserver->ops->new_lease_key(&fid);\n \tcifs_add_pending_open(&fid, tlink, &open);\n \n-\tpath = alloc_parent_path(dentry, size - 1);\n+\tpath = alloc_parent_path(dentry, namesize - 1);\n \tif (IS_ERR(path)) {\n \t\tcifs_del_pending_open(&open);\n \t\trc = PTR_ERR(path);\n@@ -1103,16 +1104,22 @@ int cifs_tmpfile(struct mnt_idmap *idmap, struct inode *dir,\n \n \tname = path + strlen(path);\n \tdo {\n-\t\tscnprintf(name, size,\n-\t\t\t  CIFS_TMPNAME_PREFIX \"%0*x\",\n-\t\t\t  CIFS_TMPNAME_COUNTER_LEN,\n-\t\t\t  atomic_inc_return(&cifs_tmpcounter));\n+\t\t/* Append tmpfile name to @path */\n+\t\tnamelen = scnprintf(name, namesize, CIFS_TMPNAME_PREFIX \"%x\",\n+\t\t\t\t    atomic_inc_return(&cifs_tmpcounter));\n \t\trc = __cifs_do_create(dir, dentry, path, xid, tlink, oflags,\n \t\t\t\t      mode, &oplock, &fid, NULL, &inode);\n \t\tif (!rc) {\n+\t\t\trc = d_mark_tmpfile_name(file, &QSTR_LEN(name, namelen));\n+\t\t\tif (rc) {\n+\t\t\t\tcifs_dbg(VFS | ONCE, \"%s: failed to set filename in dentry: %d\\n\",\n+\t\t\t\t\t __func__, rc);\n+\t\t\t\trc = -EISDIR;\n+\t\t\t\tiput(inode);\n+\t\t\t\tgoto err_open;\n+\t\t\t}\n \t\t\tset_nlink(inode, 0);\n \t\t\tmark_inode_dirty(inode);\n-\t\t\td_mark_tmpfile_name(file, &QSTR_LEN(name, size - 1));\n \t\t\td_instantiate(dentry, inode);\n \t\t\tbreak;\n \t\t}\n@@ -1168,9 +1175,7 @@ char *cifs_silly_fullpath(struct dentry *dentry)\n \n \tdo {\n \t\tdput(sdentry);\n-\t\tscnprintf(name, namesize,\n-\t\t\t  CIFS_SILLYNAME_PREFIX \"%0*x\",\n-\t\t\t  CIFS_SILLYNAME_COUNTER_LEN,\n+\t\tscnprintf(name, namesize, CIFS_SILLYNAME_PREFIX \"%x\",\n \t\t\t  atomic_inc_return(&cifs_sillycounter));\n \t\tsdentry = lookup_noperm(&QSTR(name), dentry->d_parent);\n \t\tif (IS_ERR(sdentry))\ndiff --git a/include/linux/dcache.h b/include/linux/dcache.h\nindex f60819dcfebd..c5bd5a74baba 100644\n--- a/include/linux/dcache.h\n+++ b/include/linux/dcache.h\n@@ -264,7 +264,7 @@ extern void d_invalidate(struct dentry *);\n extern struct dentry * d_make_root(struct inode *);\n \n extern void d_mark_tmpfile(struct file *, struct inode *);\n-void d_mark_tmpfile_name(struct file *file, const struct qstr *name);\n+int d_mark_tmpfile_name(struct file *file, const struct qstr *name);\n extern void d_tmpfile(struct file *, struct inode *);\n \n extern struct dentry *d_find_alias(struct inode *);\n",
    "prefixes": []
}