get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2231748,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2231748/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260501112023.338005-12-sprasad@microsoft.com/",
    "project": {
        "id": 12,
        "url": "http://patchwork.ozlabs.org/api/1.1/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": ""
    },
    "msgid": "<20260501112023.338005-12-sprasad@microsoft.com>",
    "date": "2026-05-01T11:20:15",
    "name": "[v4,12/19] cifs: register a shrinker to manage cached_dirents",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "a42cc0ae9c4659f2bcb01e8df06fcea845a0043b",
    "submitter": {
        "id": 79368,
        "url": "http://patchwork.ozlabs.org/api/1.1/people/79368/?format=api",
        "name": "Shyam Prasad N",
        "email": "nspmangalore@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260501112023.338005-12-sprasad@microsoft.com/mbox/",
    "series": [
        {
            "id": 502444,
            "url": "http://patchwork.ozlabs.org/api/1.1/series/502444/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-cifs-client/list/?series=502444",
            "date": "2026-05-01T11:20:06",
            "name": "[v4,01/19] cifs: change_conf needs to be called for session setup",
            "version": 4,
            "mbox": "http://patchwork.ozlabs.org/series/502444/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2231748/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2231748/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "\n <linux-cifs+bounces-11336-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 unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=KwqsABLc;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c15:e001:75::12fc:5321; helo=sin.lore.kernel.org;\n envelope-from=linux-cifs+bounces-11336-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)",
            "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=\"KwqsABLc\"",
            "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.210.182",
            "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com",
            "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=gmail.com"
        ],
        "Received": [
            "from sin.lore.kernel.org (sin.lore.kernel.org\n [IPv6:2600:3c15:e001:75::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g6TFZ6ZGXz1y04\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 01 May 2026 21:24:02 +1000 (AEST)",
            "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sin.lore.kernel.org (Postfix) with ESMTP id A9BF3300BC77\n\tfor <incoming@patchwork.ozlabs.org>; Fri,  1 May 2026 11:22:59 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id EA0683A0E9A;\n\tFri,  1 May 2026 11:20:46 +0000 (UTC)",
            "from mail-pf1-f182.google.com (mail-pf1-f182.google.com\n [209.85.210.182])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C7633A0E84\n\tfor <linux-cifs@vger.kernel.org>; Fri,  1 May 2026 11:20:45 +0000 (UTC)",
            "by mail-pf1-f182.google.com with SMTP id\n d2e1a72fcca58-82f8893bff3so904222b3a.2\n        for <linux-cifs@vger.kernel.org>;\n Fri, 01 May 2026 04:20:45 -0700 (PDT)",
            "from sprasad-dev1.corp.microsoft.com ([167.220.110.216])\n        by smtp.gmail.com with ESMTPSA id\n d2e1a72fcca58-8351587db67sm2331922b3a.13.2026.05.01.04.20.43\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Fri, 01 May 2026 04:20:43 -0700 (PDT)"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777634446; cv=none;\n b=JmNMYiYSGkWzo5S5jc7Mwa/3M0XFkCKwZCES6M+vg+xNFhXOLKumeNt3YlNYyLDPn8RNwF+C/hgcoNcKNEuhEWUJmvEpikxA4LTuW86U78+ovTh5Im5ShKYy+dn/8wGt9eJEy7LTmhAYiYsmGMRwLDtB6jQ1AK663n6Ud6wiQ38=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777634446; c=relaxed/simple;\n\tbh=dqM+OIMm/FolEhXWiZwlX21e6UtqoaVlDP5evwvYHl4=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=bFP/sYzDNJlV34UGVAOmI1shk4ChctquE4hhmUVULqmmczmhmdft6XsxM8wlBDOarAVb3eqEYuDIREy27xxhfMH13Xvd+3ykHM5Li9TyvriDKMUpAZy6tJHc57/H2X9thfJUWIjC2matN8apHTki6BCdDLFAU6FAbdsj6SPUkjI=",
        "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com;\n spf=pass smtp.mailfrom=gmail.com;\n dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=KwqsABLc; arc=none smtp.client-ip=209.85.210.182",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=gmail.com; s=20251104; t=1777634444; x=1778239244;\n darn=vger.kernel.org;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=WzzvatsWQlTBCszh4aTpD+tIu471HTtNRSO4+Bzjhio=;\n        b=KwqsABLcYAq6anZeOdt+gxViMaZGPNBhOFSsf4MPHzzlF2/CQgXaKwcqbchdNgUkqS\n         A2yjQqpNoyiSmrdHJHCNBBok2IZfsahEuvGP5VzAGshW+gD9I1bP0oVESuriI3lSN9gB\n         +ALP1MVLd2I7uPokPIspTsBmwigLv9u2gbh8Ka5EmezX0NJjlh1Yycce1nl30Kmf2ylV\n         T6ZOmMrpkxGvqOv/dzqiagj9cZ+To8nRznfD6obPY3NsFfgBQaAW4hZVJoD7juYhyENN\n         xENTP/PwfaIpsE8RCG8NdKsCCJ5L69EA83jWHeVeGA9hFkhU7vgmpIsGk+vcVBrBudSd\n         2BsQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1777634444; x=1778239244;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n         :to:cc:subject:date:message-id:reply-to;\n        bh=WzzvatsWQlTBCszh4aTpD+tIu471HTtNRSO4+Bzjhio=;\n        b=mBcalkCVGGq0vYtBrEG9JqHTJURx1CccGGCAPgjbDJM1tt6fPpoEAKZ0ADeLAdTwVJ\n         Jdyiqh9dOmMXPlT+vb/A0jiiBTUFfW6YurR+LqNst7++A3r5yX/mhoIukqxqT8dS8w6k\n         uLuXXqx/1de7sNmWMCM86vI3bGlB0tgvwd6m52UDWBErHSHKGtv5RpDthdLpBnM/CbvV\n         u3SuhO/iFG52JkJu8ciJvLL62Dvb9H2hohxehIGbdKFCM6VxFHpdARJ/jVIoyQMg47Fj\n         PraUwtE75PHsevd9Fty5+YropjYUzvRgD2d1MGpYTnPmqy8CBwV8JJbMW6AqjaX1cdxI\n         7XSg==",
        "X-Gm-Message-State": "AOJu0YxetaIgaaWZnU5euIzfp4s8QJsCor+kMA1bD+v7qQbYpL+Rbqo9\n\t6wPsaa6i/d8wfdQcPqLjFkUQNiJthlt4CcNCvYGC3ts+vr7quDTpl5NpKwl7JCroG88=",
        "X-Gm-Gg": "AeBDietek4kVaVAppeX5FVemuMHtYUn/JEvGvCpXHVO4YmUfEZTTxU7+UbC7wG5DOZH\n\tMEx/L122MSTUcSzPAGqMl7NRrUD4nLygjVDgZQZyYhvw49BJDJxShuj1Ru7gc5Go0nzpo6oC92O\n\t8VlhVrh9yLNgzyUV8KmTZen1qEFDN/Gll2UmDhbMMXbX6MXbZEiI8ta7TRB2J6z82gM3sy49ffj\n\t56C//xkV6D/fHOyhsu/kkFbXp5VUCzRyRQPJA9MbdwsH+mDqUvsR/aHMq1KDSgPiQQ6F6IlQQzV\n\tSRACJ2YO5H2/M+BJ4ssS7yV9PkS0NPdJSFiCMAIETn3VuJ5p2gTwJuCP/WMZGFfRen1lUdeqvrJ\n\t8scaPBswQv35u47R/Zu6c1izTydzCUvobOXeu+yQHtcvEe+l1YTLstcGEaBfCrO4sNk0Fg29wsO\n\tuA5ROccLo9vgwghAqe7aP6ovpZRo6SGcu1aDT9O6Y444NBmzwI/zYl9xvnzA+PGuiY",
        "X-Received": "by 2002:a05:6a00:14cc:b0:82f:120:fd6f with SMTP id\n d2e1a72fcca58-83519e75592mr2826383b3a.0.1777634444507;\n        Fri, 01 May 2026 04:20:44 -0700 (PDT)",
        "From": "nspmangalore@gmail.com",
        "X-Google-Original-From": "sprasad@microsoft.com",
        "To": "linux-cifs@vger.kernel.org,\n\tsmfrench@gmail.com,\n\tpc@manguebit.org,\n\tbharathsm@microsoft.com,\n\tdhowells@redhat.com,\n\thenrique.carvalho@suse.com,\n\tematsumiya@suse.de",
        "Cc": "Shyam Prasad N <sprasad@microsoft.com>",
        "Subject": "[PATCH v4 12/19] cifs: register a shrinker to manage cached_dirents",
        "Date": "Fri,  1 May 2026 16:50:15 +0530",
        "Message-ID": "<20260501112023.338005-12-sprasad@microsoft.com>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20260501112023.338005-1-sprasad@microsoft.com>",
        "References": "<20260501112023.338005-1-sprasad@microsoft.com>",
        "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": "From: Shyam Prasad N <sprasad@microsoft.com>\n\nSince the cached_dirents are now backed by folioq, we do not need\na timed cleanup of these cfids anymore. This change registers a\nshrinker with the mm layer for the dircache. If mm needs to free up\nmemory or flush the cache, it can inform cifs about this using the\nshrinker interface.\n\nSigned-off-by: Shyam Prasad N <sprasad@microsoft.com>\n---\n fs/smb/client/cifsfs.c | 86 +++++++++++++++++++++++++++++++++++++++---\n 1 file changed, 80 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c\nindex 32d0305a1239a..ee5de358e27f8 100644\n--- a/fs/smb/client/cifsfs.c\n+++ b/fs/smb/client/cifsfs.c\n@@ -29,6 +29,7 @@\n #include <linux/uuid.h>\n #include <linux/xattr.h>\n #include <linux/mm.h>\n+#include <linux/shrinker.h>\n #include <linux/key-type.h>\n #include <uapi/linux/magic.h>\n #include <net/ipv6.h>\n@@ -123,27 +124,86 @@ MODULE_PARM_DESC(dir_cache_timeout, \"Number of seconds to cache directory conten\n \t\t\t\t \"Range: 1 to 65000 seconds, 0 to disable caching dir contents\");\n /* Module-wide total cached dirents (in bytes) across all tcons */\n atomic64_t cifs_dircache_bytes_used = ATOMIC64_INIT(0);\n+static struct shrinker *cifs_dircache_shrinker;\n \n /*\n  * Write-only module parameter to drop all cached directory entries across\n  * all CIFS mounts. Echo a non-zero value to trigger.\n  */\n-static void cifs_drop_all_dir_caches(void)\n+static unsigned long cifs_drop_all_dir_caches(bool wait, unsigned long nr_to_free)\n {\n \tstruct TCP_Server_Info *server;\n \tstruct cifs_ses *ses;\n \tstruct cifs_tcon *tcon;\n+\tu64 before, after, freed_bytes = 0;\n+\tu64 target_bytes;\n+\n+\tbefore = atomic64_read(&cifs_dircache_bytes_used);\n+\tif (nr_to_free == ULONG_MAX)\n+\t\ttarget_bytes = U64_MAX;\n+\telse\n+\t\ttarget_bytes = (u64)nr_to_free * PAGE_SIZE;\n \n \tspin_lock(&cifs_tcp_ses_lock);\n \tlist_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {\n \t\tlist_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {\n \t\t\tif (cifs_ses_exiting(ses))\n \t\t\t\tcontinue;\n-\t\t\tlist_for_each_entry(tcon, &ses->tcon_list, tcon_list)\n-\t\t\t\tinvalidate_all_cached_dirs(tcon);\n+\t\t\tlist_for_each_entry(tcon, &ses->tcon_list, tcon_list) {\n+\t\t\t\tinvalidate_all_cached_dirs_nowait(tcon);\n+\t\t\t\tafter = atomic64_read(&cifs_dircache_bytes_used);\n+\t\t\t\tif (after < before)\n+\t\t\t\t\tfreed_bytes = before - after;\n+\t\t\t\tif (freed_bytes >= target_bytes)\n+\t\t\t\t\tgoto out_unlock;\n+\t\t\t}\n \t\t}\n \t}\n+out_unlock:\n \tspin_unlock(&cifs_tcp_ses_lock);\n+\n+\tif (wait)\n+\t\tflush_workqueue(cfid_put_wq);\n+\n+\tafter = atomic64_read(&cifs_dircache_bytes_used);\n+\tif (after >= before)\n+\t\treturn 0;\n+\treturn (unsigned long)(before - after);\n+}\n+\n+static unsigned long cifs_dircache_shrinker_count(struct shrinker *shrink,\n+\t\t\t\t\t\t   struct shrink_control *sc)\n+{\n+\tu64 bytes = atomic64_read(&cifs_dircache_bytes_used);\n+\n+\t(void)shrink;\n+\t(void)sc;\n+\n+\treturn DIV_ROUND_UP_ULL(bytes, PAGE_SIZE);\n+}\n+\n+static unsigned long cifs_dircache_shrinker_scan(struct shrinker *shrink,\n+\t\t\t\t\t\t  struct shrink_control *sc)\n+{\n+\tunsigned long freed_bytes;\n+\n+\t(void)shrink;\n+\n+\tif (!sc->nr_to_scan)\n+\t\treturn 0;\n+\n+\tif (!atomic64_read(&cifs_dircache_bytes_used))\n+\t\treturn SHRINK_STOP;\n+\n+\t/*\n+\t * Shrinker scan can run from reclaim context, so avoid synchronously\n+\t * flushing worker queues here to prevent long stalls/deadlocks.\n+\t */\n+\tfreed_bytes = cifs_drop_all_dir_caches(false, max_t(unsigned long, 1, sc->nr_to_scan));\n+\tif (!freed_bytes)\n+\t\treturn SHRINK_STOP;\n+\n+\treturn DIV_ROUND_UP_ULL(freed_bytes, PAGE_SIZE);\n }\n \n static int cifs_param_set_drop_dir_cache(const char *val, const struct kernel_param *kp)\n@@ -154,7 +214,7 @@ static int cifs_param_set_drop_dir_cache(const char *val, const struct kernel_pa\n \tif (rc)\n \t\treturn rc;\n \tif (bv)\n-\t\tcifs_drop_all_dir_caches();\n+\t\tcifs_drop_all_dir_caches(true, ULONG_MAX);\n \treturn 0;\n }\n \n@@ -2038,10 +2098,19 @@ init_cifs(void)\n \tif (rc)\n \t\tgoto out_destroy_mids;\n \n+\tcifs_dircache_shrinker = shrinker_alloc(0, \"cifs-dircache\");\n+\tif (!cifs_dircache_shrinker) {\n+\t\trc = -ENOMEM;\n+\t\tgoto out_destroy_request_bufs;\n+\t}\n+\tcifs_dircache_shrinker->count_objects = cifs_dircache_shrinker_count;\n+\tcifs_dircache_shrinker->scan_objects = cifs_dircache_shrinker_scan;\n+\tshrinker_register(cifs_dircache_shrinker);\n+\n #ifdef CONFIG_CIFS_DFS_UPCALL\n \trc = dfs_cache_init();\n \tif (rc)\n-\t\tgoto out_destroy_request_bufs;\n+\t\tgoto out_free_dircache_shrinker;\n #endif /* CONFIG_CIFS_DFS_UPCALL */\n #ifdef CONFIG_CIFS_UPCALL\n \trc = init_cifs_spnego();\n@@ -2083,8 +2152,11 @@ init_cifs(void)\n #endif\n #ifdef CONFIG_CIFS_DFS_UPCALL\n \tdfs_cache_destroy();\n-out_destroy_request_bufs:\n+out_free_dircache_shrinker:\n #endif\n+\tshrinker_free(cifs_dircache_shrinker);\n+\tcifs_dircache_shrinker = NULL;\n+out_destroy_request_bufs:\n \tcifs_destroy_request_bufs();\n out_destroy_mids:\n \tdestroy_mids();\n@@ -2117,6 +2189,8 @@ exit_cifs(void)\n \tcifs_dbg(NOISY, \"exit_smb3\\n\");\n \tunregister_filesystem(&cifs_fs_type);\n \tunregister_filesystem(&smb3_fs_type);\n+\tshrinker_free(cifs_dircache_shrinker);\n+\tcifs_dircache_shrinker = NULL;\n \tcifs_release_automount_timer();\n \texit_cifs_idmap();\n #ifdef CONFIG_CIFS_SWN_UPCALL\n",
    "prefixes": [
        "v4",
        "12/19"
    ]
}