rpc.idmapd runs out of file descriptors
Subsystems (2)
Observed on Debian 12 (nfs-utils 2.6.2):
May 28 09:40:25 HOSTNAME rpc.idmapd[3602614]: dirscancb: scandir(/run/rpc_pipefs/nfs): Too many open files
[repeated multiple times]
Investigation with lsof on one of the affected systems shows that file desciptors are not being closed:
[...]
rpc.idmap 675 root 126r DIR 0,40 0 10813 /run/rpc_pipefs/nfs/clnt11e6 (deleted) rpc.idmap 675 root 127u FIFO 0,40 0t0 10817 /run/rpc_pipefs/nfs/clnt11e6/idmap (deleted) rpc.idmap 675 root 128r DIR 0,40 0 10834 /run/rpc_pipefs/nfs/clnt11ef (deleted) rpc.idmap 675 root 129u FIFO 0,40 0t0 10838 /run/rpc_pipefs/nfs/clnt11ef/idmap (deleted) rpc.idmap 675 root 130r DIR 0,40 0 10855 /run/rpc_pipefs/nfs/clnt11f8 (deleted) rpc.idmap 675 root 131u FIFO 0,40 0t0 10859 /run/rpc_pipefs/nfs/clnt11f8/idmap (deleted)
Raising the verbosity level to 3 results in no "Stale client:" lines. strace shows no close() calls other than for the /run/rpc_pipefs/nfs directory.
I believe this is because in dirscancb() the loop is exited prematurely the first time nfsopen() returns -1, preventing later entries in the queue from being reaped. I've tested the patch below, which seems indeed to cure the problem. The bug appears to be still unfixed in the current master branch.
From: Sergio Gelato <[email protected]>
Date: Tue, 4 Jun 2024 16:02:59 +0200
Subject: rpc.idmapd: nfsopen() failures should not be fatal
dirscancb() loops over all clnt* subdirectories of /run/rpc_pipefs/nfs/. Some of these directories contain /idmap files, others don't. nfsopen() returns -1 for the latter; we then want to skip the directory, not abort the entire scan.
--- utils/idmapd/idmapd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
utils/idmapd/idmapd.c +1 -1
@@ -556,7 +556,7 @@ dirscancb(int fd, short UNUSED(which), void *data)if (nfsopen (ic) ==-1 ) {close (ic->ic_dirfd);free (ic); - goto out; +continue ; }if (verbose >2 )
Hi all,
Quoted 40 lines · Sergio Gelato
Observed on Debian 12 (nfs-utils 2.6.2):
May 28 09:40:25 HOSTNAME rpc.idmapd[3602614]: dirscancb: scandir(/run/rpc_pipefs/nfs): Too many open files[repeated multiple times]
Investigation with lsof on one of the affected systems shows that file desciptors are not being closed:
[...]
rpc.idmap 675 root 126r DIR 0,40 0 10813 /run/rpc_pipefs/nfs/clnt11e6 (deleted) rpc.idmap 675 root 127u FIFO 0,40 0t0 10817 /run/rpc_pipefs/nfs/clnt11e6/idmap (deleted) rpc.idmap 675 root 128r DIR 0,40 0 10834 /run/rpc_pipefs/nfs/clnt11ef (deleted) rpc.idmap 675 root 129u FIFO 0,40 0t0 10838 /run/rpc_pipefs/nfs/clnt11ef/idmap (deleted) rpc.idmap 675 root 130r DIR 0,40 0 10855 /run/rpc_pipefs/nfs/clnt11f8 (deleted) rpc.idmap 675 root 131u FIFO 0,40 0t0 10859 /run/rpc_pipefs/nfs/clnt11f8/idmap (deleted)Raising the verbosity level to 3 results in no "Stale client:" lines. strace shows no
close()calls other than for the/run/rpc_pipefs/nfsdirectory.I believe this is because in
dirscancb()the loop is exited prematurely the first timenfsopen()returns -1, preventing later entries in the queue from being reaped. I've tested the patch below, which seems indeed to cure the problem. The bug appears to be still unfixed in the current master branch.From: Sergio Gelato <[email protected]>
Date: Tue, 4 Jun 2024 16:02:59 +0200
Subject: rpc.idmapd:nfsopen()failures should not be fatal
dirscancb()loops over all clnt* subdirectories of/run/rpc_pipefs/nfs/. Some of these directories contain /idmap files, others don't.nfsopen()returns -1 for the latter; we then want to skip the directory, not abort the entire scan.--- utils/idmapd/idmapd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)utils/idmapd/idmapd.c +0
-0
utils/idmapd/idmapd.c dirscancb(int fd, short UNUSED(which), void *data) · line 562
Quoted 8 lines
utils/idmapd/idmapd.c +1
-1@@ -556,7 +556,7 @@ dirscancb(int fd, short UNUSED(which), void *data)if (nfsopen (ic) ==-1 ) {close (ic->ic_dirfd);free (ic); - goto out; +continue ; }if (verbose >2 )
Did this felt trough the cracks? Does the patch from Sergio looks good to you?
Regards,
Salvatore
NeilBrown
Reviewed-byQuoted 50 lines · Salvatore Bonaccorso
Hi all,
Quoted 47 lines · Sergio Gelato
Observed on Debian 12 (nfs-utils 2.6.2):
May 28 09:40:25 HOSTNAME rpc.idmapd[3602614]: dirscancb: scandir(/run/rpc_pipefs/nfs): Too many open files[repeated multiple times]
Investigation with lsof on one of the affected systems shows that file desciptors are not being closed:
[...]
rpc.idmap 675 root 126r DIR 0,40 0 10813 /run/rpc_pipefs/nfs/clnt11e6 (deleted) rpc.idmap 675 root 127u FIFO 0,40 0t0 10817 /run/rpc_pipefs/nfs/clnt11e6/idmap (deleted) rpc.idmap 675 root 128r DIR 0,40 0 10834 /run/rpc_pipefs/nfs/clnt11ef (deleted) rpc.idmap 675 root 129u FIFO 0,40 0t0 10838 /run/rpc_pipefs/nfs/clnt11ef/idmap (deleted) rpc.idmap 675 root 130r DIR 0,40 0 10855 /run/rpc_pipefs/nfs/clnt11f8 (deleted) rpc.idmap 675 root 131u FIFO 0,40 0t0 10859 /run/rpc_pipefs/nfs/clnt11f8/idmap (deleted)Raising the verbosity level to 3 results in no "Stale client:" lines. strace shows no
close()calls other than for the/run/rpc_pipefs/nfsdirectory.I believe this is because in
dirscancb()the loop is exited prematurely the first timenfsopen()returns -1, preventing later entries in the queue from being reaped. I've tested the patch below, which seems indeed to cure the problem. The bug appears to be still unfixed in the current master branch.From: Sergio Gelato <[email protected]>
Date: Tue, 4 Jun 2024 16:02:59 +0200
Subject: rpc.idmapd:nfsopen()failures should not be fatal
dirscancb()loops over all clnt* subdirectories of/run/rpc_pipefs/nfs/. Some of these directories contain /idmap files, others don't.nfsopen()returns -1 for the latter; we then want to skip the directory, not abort the entire scan.--- utils/idmapd/idmapd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)utils/idmapd/idmapd.c +1
-1@@ -556,7 +556,7 @@ dirscancb(int fd, short UNUSED(which), void *data)if (nfsopen (ic) ==-1 ) {close (ic->ic_dirfd);free (ic); - goto out; +continue ; }
Quoted 8 lines
utils/idmapd/idmapd.c dirscancb(int fd, short UNUSED(which), void *data) · line 562
Quoted 1 line
utils/idmapd/idmapd.c +0
-0if (verbose >2 )Did this felt trough the cracks? Does the patch from Sergio looks good to you?
Regards,
Salvatore
It probably fell through the cracks. It is always good to mail nfs-utils patches to SteveD as well as the list. You've done that now so hopefully he will pick it up.
I think that patch looks good and sensible.
Thanks,
NeilBrown
Quoted 50 lines · Salvatore Bonaccorso
Hi all,
Quoted 47 lines · Sergio Gelato
Observed on Debian 12 (nfs-utils 2.6.2):
May 28 09:40:25 HOSTNAME rpc.idmapd[3602614]: dirscancb: scandir(/run/rpc_pipefs/nfs): Too many open files[repeated multiple times]
Investigation with lsof on one of the affected systems shows that file desciptors are not being closed:
[...]
rpc.idmap 675 root 126r DIR 0,40 0 10813 /run/rpc_pipefs/nfs/clnt11e6 (deleted) rpc.idmap 675 root 127u FIFO 0,40 0t0 10817 /run/rpc_pipefs/nfs/clnt11e6/idmap (deleted) rpc.idmap 675 root 128r DIR 0,40 0 10834 /run/rpc_pipefs/nfs/clnt11ef (deleted) rpc.idmap 675 root 129u FIFO 0,40 0t0 10838 /run/rpc_pipefs/nfs/clnt11ef/idmap (deleted) rpc.idmap 675 root 130r DIR 0,40 0 10855 /run/rpc_pipefs/nfs/clnt11f8 (deleted) rpc.idmap 675 root 131u FIFO 0,40 0t0 10859 /run/rpc_pipefs/nfs/clnt11f8/idmap (deleted)Raising the verbosity level to 3 results in no "Stale client:" lines. strace shows no
close()calls other than for the/run/rpc_pipefs/nfsdirectory.I believe this is because in
dirscancb()the loop is exited prematurely the first timenfsopen()returns -1, preventing later entries in the queue from being reaped. I've tested the patch below, which seems indeed to cure the problem. The bug appears to be still unfixed in the current master branch.From: Sergio Gelato <[email protected]>
Date: Tue, 4 Jun 2024 16:02:59 +0200
Subject: rpc.idmapd:nfsopen()failures should not be fatal
dirscancb()loops over all clnt* subdirectories of/run/rpc_pipefs/nfs/. Some of these directories contain /idmap files, others don't.nfsopen()returns -1 for the latter; we then want to skip the directory, not abort the entire scan.--- utils/idmapd/idmapd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)utils/idmapd/idmapd.c +1
-1@@ -556,7 +556,7 @@ dirscancb(int fd, short UNUSED(which), void *data)if (nfsopen (ic) ==-1 ) {close (ic->ic_dirfd);free (ic); - goto out; +continue ; }
Quoted 4 lines
utils/idmapd/idmapd.c dirscancb(int fd, short UNUSED(which), void *data) · line 562
Quoted 1 line
utils/idmapd/idmapd.c +0
-0if (verbose >2 )Did this felt trough the cracks? Does the patch from Sergio looks good to you?
It did because it was not in the appropriate format... The patch was an attachment, not in-line, no Signed-off-by: line and the patch was not create by git format-patch command (which adds PATCH in the subject line).
I have filters that look for things like that and I just didn't see it...
steved.
Quoted 4 lines · Steve Dickson
It did because it was not in the appropriate format... The patch was an attachment, not in-line, no Signed-off-by: line and the patch was not create by git format-patch command (which adds PATCH in the subject line).
I see no mention of formatting requirements at
https://www.linux-nfs.org/wiki/index.php/Reporting_bugs
(not even by reference to the Linux kernel tree).
Hi all,
Quoted 9 lines · On Mon, Sep 16, 2024 at 02:28:50PM +0200, [email protected] wrote:
Quoted 4 lines · Steve Dickson
It did because it was not in the appropriate format... The patch was an attachment, not in-line, no Signed-off-by: line and the patch was not create by git format-patch command (which adds PATCH in the subject line).
I see no mention of formatting requirements at
https://www.linux-nfs.org/wiki/index.php/Reporting_bugs
(not even by reference to the Linux kernel tree).
Thank you all for looking into it. Steve, do you need to have it re-submitted in a git format-patch format? At least a Signed-off-by line by Sergio would be needed in my understanding.
Regards,
Salvatore
Hi all,
Quoted 9 lines · Salvatore Bonaccorso
Hi all,
Quoted 6 lines · On Mon, Sep 16, 2024 at 02:28:50PM +0200, [email protected] wrote:
Quoted 4 lines · Steve Dickson
It did because it was not in the appropriate format... The patch was an attachment, not in-line, no Signed-off-by: line and the patch was not create by git format-patch command (which adds PATCH in the subject line).
Quoted 7 lines
Quoted 3 lines
I see no mention of formatting requirements at
https://www.linux-nfs.org/wiki/index.php/Reporting_bugs
(not even by reference to the Linux kernel tree).Thank you all for looking into it. Steve, do you need to have it re-submitted in a git format-patch format? At least a Signed-off-by line by Sergio would be needed in my understanding.
I guess otherwise we can use soemthing like the following though a Signed-off-by is probably not right here, or is it enough if I say
Reported-by: and Patch-originally-by: although the later is not an official kernel doc mentioned tag?
Regards,
Salvatore
From 997981dd8d2b5977dd4cd54dab59de4ee3f57725 Mon Sep 17 00:00:00 2001
From: Sergio Gelato <[email protected]>
Date: Tue, 4 Jun 2024 16:02:59 +0200
Subject: [PATCH] rpc.idmapd: nfsopen() failures should not be fatal
dirscancb() loops over all clnt* subdirectories of /run/rpc_pipefs/nfs/. Some of these directories contain /idmap files, others don't. nfsopen() returns -1 for the latter; we then want to skip the directory, not abort the entire scan.
--- utils/idmapd/idmapd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
utils/idmapd/idmapd.c +1 -1
@@ -556,7 +556,7 @@ dirscancb(int fd, short UNUSED(which), void *data)if (nfsopen (ic) ==-1 ) {close (ic->ic_dirfd);free (ic); - goto out; +continue ; }if (verbose >2 )
Signature · 1 line
2.45.2
Hi,
Quoted 16 lines · Salvatore Bonaccorso
Hi all,
Quoted 13 lines · Salvatore Bonaccorso
Hi all,
Quoted 9 lines · On Mon, Sep 16, 2024 at 02:28:50PM +0200, [email protected] wrote:
Quoted 4 lines · Steve Dickson
It did because it was not in the appropriate format... The patch was an attachment, not in-line, no Signed-off-by: line and the patch was not create by git format-patch command (which adds PATCH in the subject line).
I see no mention of formatting requirements at
https://www.linux-nfs.org/wiki/index.php/Reporting_bugs
(not even by reference to the Linux kernel tree).
Quoted 8 lines
Quoted 3 lines
Thank you all for looking into it. Steve, do you need to have it re-submitted in a git format-patch format? At least a Signed-off-by line by Sergio would be needed in my understanding.
I guess otherwise we can use soemthing like the following though a Signed-off-by is probably not right here, or is it enough if I say
Reported-by: and Patch-originally-by: although the later is not an official kernel doc mentioned tag?
And then one seems to be able to do so many mistakes around one patch. Here is an improved version (v2), fixing a typo in the Link reference and using a Closes: tag after the Reported-by:
This now should be better than the previous one.
Regards,
Salvatore
From 46989ce210d27dbb3ad89095030c687db70c78be Mon Sep 17 00:00:00 2001
From: Sergio Gelato <[email protected]>
Date: Tue, 4 Jun 2024 16:02:59 +0200
Subject: [PATCH v2] rpc.idmapd: nfsopen() failures should not be fatal
dirscancb() loops over all clnt* subdirectories of /run/rpc_pipefs/nfs/. Some of these directories contain /idmap files, others don't. nfsopen() returns -1 for the latter; we then want to skip the directory, not abort the entire scan.
---
Changes in v2:
- Fix typo in URL for Debian bug reference
- Reorder patch tags and use Closes tag after Reported-by
utils/idmapd/idmapd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
utils/idmapd/idmapd.c +1 -1
@@ -556,7 +556,7 @@ dirscancb(int fd, short UNUSED(which), void *data)if (nfsopen (ic) ==-1 ) {close (ic->ic_dirfd);free (ic); - goto out; +continue ; }if (verbose >2 )
Signature · 1 line
2.45.2
Quoted 7 lines · Salvatore Bonaccorso
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines · Steve Dickson
Quoted 4 lines
It did because it was not in the appropriate format... The patch was an attachment, not in-line, no Signed-off-by: line and the patch was not create by git format-patch command (which adds PATCH in the subject line).
(not even by reference to the Linux kernel tree).
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Thank you all for looking into it. Steve, do you need to have it re-submitted in a git format-patch format? At least a Signed-off-by line by Sergio would be needed in my understanding.
I guess otherwise we can use soemthing like the following though a Signed-off-by is probably not right here, or is it enough if I say
Reported-by: and Patch-originally-by: although the later is not an official kernel doc mentioned tag?
I don't object to (nor do I require) your adding a
(I am indeed the author of the patch, and it's too trivial to be copyrightable anyway).
I guess Neil's comment earlier can be taken as equivalent to an Acked-by:.
By the way, I have wondered whether to change the other two instances of "goto out" in dirscancb() as well. For the first one (calloc() failure) I think this would be counterproductive (one is likely to get the same error on all subsequent iterations), the second (directory open()) is more debatable (but failure of the directory open() should be so rare that it doesn't matter).
Quoted 48 lines
And then one seems to be able to do so many mistakes around one patch. Here is an improved version (v2), fixing a typo in the Link reference and using a Closes: tag after the Reported-by:
This now should be better than the previous one.
Regards,
SalvatoreFrom
46989ce210d27dbb3ad89095030c687db70c78beMon Sep 17 00:00:00 2001
From: Sergio Gelato <[email protected]>
Date: Tue, 4 Jun 2024 16:02:59 +0200
Subject: [PATCH v2] rpc.idmapd:nfsopen()failures should not be fatal
dirscancb()loops over all clnt* subdirectories of/run/rpc_pipefs/nfs/. Some of these directories contain /idmap files, others don't.nfsopen()returns -1 for the latter; we then want to skip the directory, not abort the entire scan.Reported-by Sergio Gelato <[email protected]>Patch-originally-by Sergio Gelato <[email protected]>Signed-off-by Salvatore Bonaccorso <[email protected]>---
Changes in v2:
- Fix typo in URL for Debian bug reference
- Reorder patch tags and use Closes tag after Reported-byutils/idmapd/idmapd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)utils/idmapd/idmapd.c +1
-1@@ -556,7 +556,7 @@ dirscancb(int fd, short UNUSED(which), void *data)if (nfsopen (ic) ==-1 ) {close (ic->ic_dirfd);free (ic); - goto out; +continue ; }if (verbose >2 )Signature · 1 line
2.45.2
Quoted 10 lines · Salvatore Bonaccorso
dirscancb()loops over all clnt* subdirectories of/run/rpc_pipefs/nfs/. Some of these directories contain /idmap files, others don't.nfsopen()returns -1 for the latter; we then want to skip the directory, not abort the entire scan.Reported-by Sergio Gelato<[email protected]>Patch-originally-by Sergio Gelato<[email protected]>Signed-off-by Salvatore Bonaccorso<[email protected]>
Committed... (tag: nfs-utils-2-7-2-rc1)
steved.
Quoted 22 lines
---
Changes in v2:
- Fix typo in URL for Debian bug reference
- Reorder patch tags and use Closes tag after Reported-byutils/idmapd/idmapd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)utils/idmapd/idmapd.c +1
-1@@ -556,7 +556,7 @@ dirscancb(int fd, short UNUSED(which), void *data)if (nfsopen (ic) ==-1 ) {close (ic->ic_dirfd);free (ic); - goto out; +continue ; }if (verbose >2 )