]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
sunrpc: add a cache_notify callback
authorJeff Layton <jlayton@kernel.org>
Wed, 25 Mar 2026 14:40:26 +0000 (10:40 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 1 Jun 2026 15:08:18 +0000 (11:08 -0400)
A later patch will be changing the kernel to send a netlink notification
when there is a pending cache_request. Add a new cache_notify operation
to struct cache_detail for this purpose.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
include/linux/sunrpc/cache.h
net/sunrpc/cache.c

index 80a3f17731d8fbc1c5252a830b202016faa41a18..c358151c23950ab48e83991c6138bb7d0e049ace 100644 (file)
@@ -80,6 +80,9 @@ struct cache_detail {
        int                     (*cache_upcall)(struct cache_detail *,
                                                struct cache_head *);
 
+       int                     (*cache_notify)(struct cache_detail *cd,
+                                               struct cache_head *h);
+
        void                    (*cache_request)(struct cache_detail *cd,
                                                 struct cache_head *ch,
                                                 char **bpp, int *blen);
index 04d30a1892d2f4551897d41daf60bcc52087b3fb..f54c6578dae964a76207ae603ff3bd02d5cfa3d1 100644 (file)
@@ -1233,6 +1233,8 @@ static int cache_do_upcall(struct cache_detail *detail, struct cache_head *h)
                /* Lost a race, no longer PENDING, so don't enqueue */
                ret = -EAGAIN;
        spin_unlock(&detail->queue_lock);
+       if (ret != -EAGAIN && detail->cache_notify)
+               detail->cache_notify(detail, h);
        wake_up(&detail->queue_wait);
        if (ret == -EAGAIN) {
                kfree(buf);