linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] jbd2_seq_info_next should increase position index
@ 2020-01-23  9:05 Vasily Averin
  2020-01-23 11:15 ` Jan Kara
  0 siblings, 1 reply; 5+ messages in thread
From: Vasily Averin @ 2020-01-23  9:05 UTC (permalink / raw)
  To: linux-ext4, Theodore Ts'o; +Cc: Jan Kara

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 </proc/fs/jbd2/DEV/info

https://bugzilla.kernel.org/show_bug.cgi?id=206283
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] jbd2_seq_info_next should increase position index
  2020-01-23  9:05 [PATCH 1/1] jbd2_seq_info_next should increase position index Vasily Averin
@ 2020-01-23 11:15 ` Jan Kara
  2020-01-23 11:30   ` Vasily Averin
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kara @ 2020-01-23 11:15 UTC (permalink / raw)
  To: Vasily Averin; +Cc: linux-ext4, Theodore Ts'o, Jan Kara

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 </proc/fs/jbd2/DEV/info

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?

								Honza

> 
> https://bugzilla.kernel.org/show_bug.cgi?id=206283
> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
> ---
>  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
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] jbd2_seq_info_next should increase position index
  2020-01-23 11:15 ` Jan Kara
@ 2020-01-23 11:30   ` Vasily Averin
  2020-01-23 14:02     ` Jan Kara
  0 siblings, 1 reply; 5+ messages in thread
From: Vasily Averin @ 2020-01-23 11:30 UTC (permalink / raw)
  To: Jan Kara; +Cc: linux-ext4, Theodore Ts'o, Jan Kara



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 </proc/fs/jbd2/DEV/info
> 
> 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 </proc/fs/jbd2/sda4-8/info  | head -20
1 151327 transactions (132200 requested), each up to 65536 blocks
2 average:
3 0ms waiting for transaction
4 0ms request delay
5 3816ms running transaction
6 0ms transaction was being locked
7 0ms flushing data (in ordered mode)
8 36ms logging transaction
9 29753us average transaction commit time
10 1587 handles per transaction
11 32 blocks per transaction
12 33 logged blocks per transaction
13 151327 transactions (132200 requested), each up to 65536 blocks
14 151327 transactions (132200 requested), each up to 65536 blocks
15 151327 transactions (132200 requested), each up to 65536 blocks
16 151327 transactions (132200 requested), each up to 65536 blocks
17 151327 transactions (132200 requested), each up to 65536 blocks
18 151327 transactions (132200 requested), each up to 65536 blocks
19 151327 transactions (132200 requested), each up to 65536 blocks
20 151327 transactions (132200 requested), each up to 65536 blocks

>> https://bugzilla.kernel.org/show_bug.cgi?id=206283
>> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
>> ---
>>  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
>>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] jbd2_seq_info_next should increase position index
  2020-01-23 11:30   ` Vasily Averin
@ 2020-01-23 14:02     ` Jan Kara
  2020-01-25  7:31       ` Theodore Y. Ts'o
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kara @ 2020-01-23 14:02 UTC (permalink / raw)
  To: Vasily Averin; +Cc: Jan Kara, linux-ext4, Theodore Ts'o, Jan Kara

On Thu 23-01-20 14:30:14, Vasily Averin wrote:
> 
> 
> 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 </proc/fs/jbd2/DEV/info
> > 
> > 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 see. OK. So please add tag:

Fixes: 1f4aace60b0e ("fs/seq_file.c: simplify seq_file iteration code and interface")

likely also:

CC: stable@vger.kernel.org

and you can also add:

Reviewed-by: Jan Kara <jack@suse.cz>

Thanks!

								Honza

> 
> 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 </proc/fs/jbd2/sda4-8/info  | head -20
> 1 151327 transactions (132200 requested), each up to 65536 blocks
> 2 average:
> 3 0ms waiting for transaction
> 4 0ms request delay
> 5 3816ms running transaction
> 6 0ms transaction was being locked
> 7 0ms flushing data (in ordered mode)
> 8 36ms logging transaction
> 9 29753us average transaction commit time
> 10 1587 handles per transaction
> 11 32 blocks per transaction
> 12 33 logged blocks per transaction
> 13 151327 transactions (132200 requested), each up to 65536 blocks
> 14 151327 transactions (132200 requested), each up to 65536 blocks
> 15 151327 transactions (132200 requested), each up to 65536 blocks
> 16 151327 transactions (132200 requested), each up to 65536 blocks
> 17 151327 transactions (132200 requested), each up to 65536 blocks
> 18 151327 transactions (132200 requested), each up to 65536 blocks
> 19 151327 transactions (132200 requested), each up to 65536 blocks
> 20 151327 transactions (132200 requested), each up to 65536 blocks
> 
> >> https://bugzilla.kernel.org/show_bug.cgi?id=206283
> >> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
> >> ---
> >>  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
> >>
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] jbd2_seq_info_next should increase position index
  2020-01-23 14:02     ` Jan Kara
@ 2020-01-25  7:31       ` Theodore Y. Ts'o
  0 siblings, 0 replies; 5+ messages in thread
From: Theodore Y. Ts'o @ 2020-01-25  7:31 UTC (permalink / raw)
  To: Jan Kara; +Cc: Vasily Averin, linux-ext4, Jan Kara

On Thu, Jan 23, 2020 at 03:02:43PM +0100, Jan Kara wrote:
> On Thu 23-01-20 14:30:14, Vasily Averin wrote:
> > 
> > 
> > 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 </proc/fs/jbd2/DEV/info
> > > 
> > > 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 see. OK. So please add tag:
> 
> Fixes: 1f4aace60b0e ("fs/seq_file.c: simplify seq_file iteration code and interface")
> 
> likely also:
> 
> CC: stable@vger.kernel.org
> 
> and you can also add:
> 
> Reviewed-by: Jan Kara <jack@suse.cz>

Thanks, applied with the suggested tags.

						- Ted

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-01-25  7:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-23  9:05 [PATCH 1/1] jbd2_seq_info_next should increase position index Vasily Averin
2020-01-23 11:15 ` Jan Kara
2020-01-23 11:30   ` Vasily Averin
2020-01-23 14:02     ` Jan Kara
2020-01-25  7:31       ` Theodore Y. Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).