Skip to content

Commit d52db76

Browse files
jtlaytonchucklever
authored andcommitted
sunrpc: add a cache_notify callback
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>
1 parent 8bfc7e1 commit d52db76

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

include/linux/sunrpc/cache.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ struct cache_detail {
8080
int (*cache_upcall)(struct cache_detail *,
8181
struct cache_head *);
8282

83+
int (*cache_notify)(struct cache_detail *cd,
84+
struct cache_head *h);
85+
8386
void (*cache_request)(struct cache_detail *cd,
8487
struct cache_head *ch,
8588
char **bpp, int *blen);

net/sunrpc/cache.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,6 +1233,8 @@ static int cache_do_upcall(struct cache_detail *detail, struct cache_head *h)
12331233
/* Lost a race, no longer PENDING, so don't enqueue */
12341234
ret = -EAGAIN;
12351235
spin_unlock(&detail->queue_lock);
1236+
if (ret != -EAGAIN && detail->cache_notify)
1237+
detail->cache_notify(detail, h);
12361238
wake_up(&detail->queue_wait);
12371239
if (ret == -EAGAIN) {
12381240
kfree(buf);

0 commit comments

Comments
 (0)