mirror of
				https://git.proxmox.com/git/mirror_zfs.git
				synced 2025-10-26 18:05:04 +03:00 
			
		
		
		
	Fix buggy procfs_list_seq_next warning
The kernel seq_read() helper function expects ->next() to update
the passed position even there are no more entries.  Failure to
do so results in the following warning being logged.
    seq_file: buggy .next function procfs_list_seq_next [spl]
    did not update position index
Functionally there is no issue with the way procfs_list_seq_next()
is implemented and the warning is harmless.  However, we want to
silence this some what scary incorrect warning.  This commit
updates the Linux procfs code to advance the position even for
the last entry.
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #10984
Closes #10996
			
			
This commit is contained in:
		
							parent
							
								
									5d61d6e8dd
								
							
						
					
					
						commit
						fc5966589b
					
				@ -89,7 +89,17 @@ procfs_list_next_node(procfs_list_cursor_t *cursor, loff_t *pos)
 | 
			
		||||
		cursor->cached_node = next_node;
 | 
			
		||||
		cursor->cached_pos = NODE_ID(procfs_list, cursor->cached_node);
 | 
			
		||||
		*pos = cursor->cached_pos;
 | 
			
		||||
	} else {
 | 
			
		||||
		/*
 | 
			
		||||
		 * seq_read() expects ->next() to update the position even
 | 
			
		||||
		 * when there are no more entries. Advance the position to
 | 
			
		||||
		 * prevent a warning from being logged.
 | 
			
		||||
		 */
 | 
			
		||||
		cursor->cached_node = NULL;
 | 
			
		||||
		cursor->cached_pos++;
 | 
			
		||||
		*pos = cursor->cached_pos;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return (next_node);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -105,6 +115,8 @@ procfs_list_seq_start(struct seq_file *f, loff_t *pos)
 | 
			
		||||
		cursor->cached_node = SEQ_START_TOKEN;
 | 
			
		||||
		cursor->cached_pos = 0;
 | 
			
		||||
		return (SEQ_START_TOKEN);
 | 
			
		||||
	} else if (cursor->cached_node == NULL) {
 | 
			
		||||
		return (NULL);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user