From patchwork Mon Nov 16 00:59:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11907039 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7101314B3 for ; Mon, 16 Nov 2020 01:01:50 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4FB6320E65 for ; Mon, 16 Nov 2020 01:01:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4FB6320E65 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lustre-devel-bounces@lists.lustre.org Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 1E322306ECD; Sun, 15 Nov 2020 17:01:25 -0800 (PST) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id BD5D721F895 for ; Sun, 15 Nov 2020 17:00:08 -0800 (PST) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 4D7CE222E; Sun, 15 Nov 2020 20:00:06 -0500 (EST) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 434FA2C7FB; Sun, 15 Nov 2020 20:00:06 -0500 (EST) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Sun, 15 Nov 2020 19:59:36 -0500 Message-Id: <1605488401-981-4-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1605488401-981-1-git-send-email-jsimmons@infradead.org> References: <1605488401-981-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 03/28] lustre: seq_file .next functions must update *pos X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Mr NeilBrown A seq_file .next function must update *pos on EOF to a value which will cause a subsequent ->start to also return EOF. If it doesn't the last record of the file can be returned twice to a 'read()'. Also the seq_file code will generate a warning. This patch fixes various ->next functions to always update *pos. WC-bug-id: https://jira.whamcloud.com/browse/LU-13985 Lustre-commit: 817d6c11659963 ("LU-13985 lustre: seq_file .next functions must update *pos") Signed-off-by: Mr NeilBrown Reviewed-on: https://review.whamcloud.com/40035 Reviewed-by: Andreas Dilger Reviewed-by: Chris Horn Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/lov/lov_pool.c | 2 +- fs/lustre/ptlrpc/lproc_ptlrpc.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/lustre/lov/lov_pool.c b/fs/lustre/lov/lov_pool.c index 9e937ac..f8f14f9 100644 --- a/fs/lustre/lov/lov_pool.c +++ b/fs/lustre/lov/lov_pool.c @@ -111,6 +111,7 @@ static void *pool_proc_next(struct seq_file *s, void *v, loff_t *pos) LASSERTF(iter->magic == POOL_IT_MAGIC, "%08X\n", iter->magic); + (*pos)++; /* test if end of file */ if (*pos >= pool_tgt_count(iter->pool)) return NULL; @@ -122,7 +123,6 @@ static void *pool_proc_next(struct seq_file *s, void *v, loff_t *pos) iter->idx = prev_idx; /* we stay on the last entry */ return NULL; } - (*pos)++; /* return != NULL to continue */ return iter; } diff --git a/fs/lustre/ptlrpc/lproc_ptlrpc.c b/fs/lustre/ptlrpc/lproc_ptlrpc.c index 4d2ae14..7276f81 100644 --- a/fs/lustre/ptlrpc/lproc_ptlrpc.c +++ b/fs/lustre/ptlrpc/lproc_ptlrpc.c @@ -932,6 +932,7 @@ struct ptlrpc_srh_iterator { } kfree(srhi); + ++*pos; return NULL; }