* [PATCH] nfsd: call cache_put if xdr_reserve_space returns NULL
@ 2024-08-21 14:03 Guoqing Jiang
2024-08-26 16:55 ` Chuck Lever
2024-08-29 11:29 ` Jeff Layton
0 siblings, 2 replies; 4+ messages in thread
From: Guoqing Jiang @ 2024-08-21 14:03 UTC (permalink / raw)
To: chuck.lever, jlayton; +Cc: neilb, okorniev, Dai.Ngo, tom, linux-nfs
If no enough buffer space available, but idmap_lookup have triggered
lookup_fn which calls cache_get and returns successfully. Then we
missed to call cache_put here which pairs with cache_get.
Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
---
fs/nfsd/nfs4idmap.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c
index 7a806ac13e31..7abddf7d8f6d 100644
--- a/fs/nfsd/nfs4idmap.c
+++ b/fs/nfsd/nfs4idmap.c
@@ -594,8 +594,10 @@ static __be32 idmap_id_to_name(struct xdr_stream *xdr,
ret = strlen(item->name);
WARN_ON_ONCE(ret > IDMAP_NAMESZ);
p = xdr_reserve_space(xdr, ret + 4);
- if (!p)
+ if (!p) {
+ cache_put(&item->h, nn->idtoname_cache);
return nfserr_resource;
+ }
p = xdr_encode_opaque(p, item->name, ret);
cache_put(&item->h, nn->idtoname_cache);
return 0;
--
2.35.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] nfsd: call cache_put if xdr_reserve_space returns NULL
2024-08-21 14:03 [PATCH] nfsd: call cache_put if xdr_reserve_space returns NULL Guoqing Jiang
@ 2024-08-26 16:55 ` Chuck Lever
2024-08-28 10:42 ` Guoqing Jiang
2024-08-29 11:29 ` Jeff Layton
1 sibling, 1 reply; 4+ messages in thread
From: Chuck Lever @ 2024-08-26 16:55 UTC (permalink / raw)
To: Guoqing Jiang; +Cc: jlayton, neilb, okorniev, Dai.Ngo, tom, linux-nfs
On Wed, 21 Aug 2024 22:03:18 +0800, Guoqing Jiang wrote:
> If no enough buffer space available, but idmap_lookup have triggered
> lookup_fn which calls cache_get and returns successfully. Then we
> missed to call cache_put here which pairs with cache_get.
>
>
I've adjusted some aspects of the patch and added a Fixes: tag.
Applied to nfsd-next for v6.12, thanks!
[1/1] nfsd: call cache_put if xdr_reserve_space returns NULL
commit: ada7d1ab3aa1266b24d08aa4b3df93360a203924
--
Chuck Lever
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] nfsd: call cache_put if xdr_reserve_space returns NULL
2024-08-26 16:55 ` Chuck Lever
@ 2024-08-28 10:42 ` Guoqing Jiang
0 siblings, 0 replies; 4+ messages in thread
From: Guoqing Jiang @ 2024-08-28 10:42 UTC (permalink / raw)
To: Chuck Lever; +Cc: jlayton, neilb, okorniev, Dai.Ngo, tom, linux-nfs
On 8/27/24 00:55, Chuck Lever wrote:
> On Wed, 21 Aug 2024 22:03:18 +0800, Guoqing Jiang wrote:
>> If no enough buffer space available, but idmap_lookup have triggered
>> lookup_fn which calls cache_get and returns successfully. Then we
>> missed to call cache_put here which pairs with cache_get.
>>
>>
> I've adjusted some aspects of the patch and added a Fixes: tag.
Thanks for the modification!
Guoqing
> Applied to nfsd-next for v6.12, thanks!
>
> [1/1] nfsd: call cache_put if xdr_reserve_space returns NULL
> commit: ada7d1ab3aa1266b24d08aa4b3df93360a203924
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] nfsd: call cache_put if xdr_reserve_space returns NULL
2024-08-21 14:03 [PATCH] nfsd: call cache_put if xdr_reserve_space returns NULL Guoqing Jiang
2024-08-26 16:55 ` Chuck Lever
@ 2024-08-29 11:29 ` Jeff Layton
1 sibling, 0 replies; 4+ messages in thread
From: Jeff Layton @ 2024-08-29 11:29 UTC (permalink / raw)
To: Guoqing Jiang, chuck.lever; +Cc: neilb, okorniev, Dai.Ngo, tom, linux-nfs
On Wed, 2024-08-21 at 22:03 +0800, Guoqing Jiang wrote:
> If no enough buffer space available, but idmap_lookup have triggered
> lookup_fn which calls cache_get and returns successfully. Then we
> missed to call cache_put here which pairs with cache_get.
>
> Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
> ---
> fs/nfsd/nfs4idmap.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c
> index 7a806ac13e31..7abddf7d8f6d 100644
> --- a/fs/nfsd/nfs4idmap.c
> +++ b/fs/nfsd/nfs4idmap.c
> @@ -594,8 +594,10 @@ static __be32 idmap_id_to_name(struct xdr_stream *xdr,
> ret = strlen(item->name);
> WARN_ON_ONCE(ret > IDMAP_NAMESZ);
> p = xdr_reserve_space(xdr, ret + 4);
> - if (!p)
> + if (!p) {
> + cache_put(&item->h, nn->idtoname_cache);
> return nfserr_resource;
> + }
> p = xdr_encode_opaque(p, item->name, ret);
> cache_put(&item->h, nn->idtoname_cache);
> return 0;
You can add this to the patch in Chuck's tree:
Reviwed-by: Jeff Layton <jlayton@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-08-29 11:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-21 14:03 [PATCH] nfsd: call cache_put if xdr_reserve_space returns NULL Guoqing Jiang
2024-08-26 16:55 ` Chuck Lever
2024-08-28 10:42 ` Guoqing Jiang
2024-08-29 11:29 ` Jeff Layton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox