If an unmount occurs between iterations, the filter function will crash when referencing the 'device' in the new mountstats. Verify it exists before trying to access it. Signed-off-by: Frank Sorenson <sorenson@xxxxxxxxxx> --- tools/nfs-iostat/nfs-iostat.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/nfs-iostat/nfs-iostat.py b/tools/nfs-iostat/nfs-iostat.py index bf5eead9..08b827c0 100755 --- a/tools/nfs-iostat/nfs-iostat.py +++ b/tools/nfs-iostat/nfs-iostat.py @@ -511,10 +511,11 @@ def list_nfs_mounts(givenlist, mountstats): devicelist = [] if len(givenlist) > 0: for device in givenlist: - stats = DeviceData() - stats.parse_stats(mountstats[device]) - if stats.is_nfs_mountpoint(): - devicelist += [device] + if device in mountstats: + stats = DeviceData() + stats.parse_stats(mountstats[device]) + if stats.is_nfs_mountpoint(): + devicelist += [device] else: for device, descr in mountstats.items(): stats = DeviceData() -- 2.48.1