nfsdclnts: fix display of stateids where the kernel doesn't provide the superblock
Subsystems (2)
PATCH 1/1 nfsdclnts: fix display of stateids where the kernel doesn't provide the superblock
If the stateid's file can't be found, the kernel will skip printing the superblock and filename in the 'states' procfile. When this happens, nfsdclnts crashes trying to reference the non-existent superblock key while getting the inode.
Fix this by setting the inode field to 'N/A' when the superblock isn't present, as is done with other fields which may be missing.
--- tools/nfsdclnts/nfsdclnts.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/nfsdclnts/nfsdclnts.py +4 -1
@@ -87,7 +87,10 @@ def printer(data_list, argument): client_info = file_to_dict(client_info_path) for i in data_list: for key in i: - inode = i[key]['superblock'].split(':')[-1] + try: + inode = i[key]['superblock'].split(':')[-1] + except: + inode = 'N/A' # The ip address is quoted, so we dequote it. try: client_ip = client_info['address'][1:-1]
Signature · 1 line
2.52.0
Quoted 9 lines · Frank Sorenson
If the stateid's file can't be found, the kernel will skip printing the superblock and filename in the 'states' procfile. When this happens, nfsdclnts crashes trying to reference the non-existent superblock key while getting the inode.
Fix this by setting the inode field to 'N/A' when the superblock isn't present, as is done with other fields which may be missing.
Signed-off-by Frank Sorenson <[email protected]>
Committed... (tag: nfs-utils-2-8-6-rc4)
steved.
Quoted 20 lines
--- tools/nfsdclnts/nfsdclnts.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)tools/nfsdclnts/nfsdclnts.py +4
-1@@ -87,7 +87,10 @@ def printer(data_list, argument): client_info = file_to_dict(client_info_path) for i in data_list: for key in i: - inode = i[key]['superblock'].split(':')[-1] + try: + inode = i[key]['superblock'].split(':')[-1] + except: + inode = 'N/A' # The ip address is quoted, so we dequote it. try: client_ip = client_info['address'][1:-1]