Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp541588ybl; Thu, 23 Jan 2020 03:31:03 -0800 (PST) X-Google-Smtp-Source: APXvYqywNtpnl1G82WHE3ZVnYsimkIpj80yDXd6Cbzs+oW8cS22s06sMmWqBJTUucZIIUV+1vEA5 X-Received: by 2002:aca:cc87:: with SMTP id c129mr9784338oig.13.1579779063211; Thu, 23 Jan 2020 03:31:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579779063; cv=none; d=google.com; s=arc-20160816; b=0CWKvOang+EK9naQ5Xjuh6kfiwMCv8rbG3/U20Qqsokd6pJc9Wn1eVmp3Zbd0kP5ts wkMfr2itPQjY3gbs3uphSkr0SKiwpIAbCFku16yOi8Y/nbStB6/XRCzz77XrjwANeHo3 Tt9n6yipAOIgcfXkgj9L7LD3BC51+nGhi+3qUWEalRnpEHUS04iXASAqIc7kL1GJm0/h mRoBVs8p+MLXgULyuj6xm0VicGz9GkGegDzkDLIUiVQvFOLmoYq9aqbKgMOXWXtEAVLX gpRy8wbUYkE9fRifYJfpvg9vRRonCXb/XlSVBT+WtDbZJpqKMtzxyHeNnIsf/h2Fraf/ k++w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=GC8S3/Ac8Vqp52lEOxGnEkK4FzgZ8XFzSGEppSZKf00=; b=pNxjX842iBiT2vxN2KB7AeH8KIVxiA9TtZGwfBzV2tedjxD4ekBLYOTFr7lzkXONNG 6KvFYUxosjNMWTk+9uisiveZu6LDkToHJrmjZY6hpTQFfsB5sgbnTqzzLYrXjQ6xuzVf mIFcmEiSfSHdP2Toj0Wu5ILtAX9gRy2we4Op3+Wy+xecTKQ9F/ME6XvbWWHmpY+wJwId dfKfxWlyY9Oo3tTTbZposSJiZkG9ffqcVdfiU81vzM63F/AwVJ5O0wrWLcI03lrRS9x/ drYZBEylemBL4NCl7aiOSSaIkRAUxc8ZcSgKZk/LA8eWBKWS69QPdenv3ywJIVebA/vf lvxg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t1si682429oic.140.2020.01.23.03.30.46; Thu, 23 Jan 2020 03:31:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726194AbgAWLa0 (ORCPT + 99 others); Thu, 23 Jan 2020 06:30:26 -0500 Received: from relay.sw.ru ([185.231.240.75]:44796 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbgAWLa0 (ORCPT ); Thu, 23 Jan 2020 06:30:26 -0500 Received: from vvs-ws.sw.ru ([172.16.24.21]) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1iuagh-0008HM-3P; Thu, 23 Jan 2020 14:30:15 +0300 Subject: Re: [PATCH 1/1] jbd2_seq_info_next should increase position index To: Jan Kara Cc: linux-ext4@vger.kernel.org, Theodore Ts'o , Jan Kara References: <20200123111543.GC5728@quack2.suse.cz> From: Vasily Averin Message-ID: <43e6a168-63b6-4a82-7b3d-5dd676b9f9bb@virtuozzo.com> Date: Thu, 23 Jan 2020 14:30:14 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20200123111543.GC5728@quack2.suse.cz> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On 1/23/20 2:15 PM, Jan Kara wrote: > On Thu 23-01-20 12:05:10, Vasily Averin wrote: >> if seq_file .next fuction does not change position index, >> read after some lseek can generate unexpected output. >> >> Script below generates endless output >> $ q=;while read -r r;do echo "$((++q)) $r";done > I've just tried and this works for me just fine with openSUSE 15.1 > (4.12.14-based) kernel. Is it some recent regression? I think it depends on commit 1f4aace60b0e ("fs/seq_file.c: simplify seq_file iteration code and interface") In OpenVz7 we got complain after backport of this patch. I've reproduced it on last ubuntu kernel $ uname -a Linux vvs-ws 5.3.0-24-generic #26~18.04.2-Ubuntu SMP Tue Nov 26 12:34:22 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux $ q=;while read -r r;do echo "$((++q)) $r";done > https://bugzilla.kernel.org/show_bug.cgi?id=206283 >> Signed-off-by: Vasily Averin >> --- >> fs/jbd2/journal.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c >> index 5e408ee..b3e2433 100644 >> --- a/fs/jbd2/journal.c >> +++ b/fs/jbd2/journal.c >> @@ -982,6 +982,7 @@ static void *jbd2_seq_info_start(struct seq_file *seq, loff_t *pos) >> >> static void *jbd2_seq_info_next(struct seq_file *seq, void *v, loff_t *pos) >> { >> + (*pos)++; >> return NULL; >> } >> >> -- >> 1.8.3.1 >>