linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs: fix iclog allocation size
@ 2019-06-27 14:39 Christoph Hellwig
  2019-06-27 15:13 ` Darrick J. Wong
  2019-06-28 22:02 ` Luis Chamberlain
  0 siblings, 2 replies; 7+ messages in thread
From: Christoph Hellwig @ 2019-06-27 14:39 UTC (permalink / raw)
  To: linux-xfs; +Cc: syzbot+b75afdbe271a0d7ac4f6

Properly allocate the space for the bio_vecs instead of just one byte
per bio_vec.

Fixes: 991fc1d2e65e ("xfs: use bios directly to write log buffers")
Reported-by: syzbot+b75afdbe271a0d7ac4f6@syzkaller.appspotmail.com
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_log.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 0f849b4095d6..e230f3c18ceb 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1415,7 +1415,8 @@ xlog_alloc_log(
 	 */
 	ASSERT(log->l_iclog_size >= 4096);
 	for (i = 0; i < log->l_iclog_bufs; i++) {
-		size_t bvec_size = howmany(log->l_iclog_size, PAGE_SIZE);
+		size_t bvec_size = howmany(log->l_iclog_size, PAGE_SIZE) *
+				sizeof(struct bio_vec);
 
 		iclog = kmem_zalloc(sizeof(*iclog) + bvec_size, KM_MAYFAIL);
 		if (!iclog)
-- 
2.20.1

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

* Re: [PATCH] xfs: fix iclog allocation size
  2019-06-27 14:39 [PATCH] xfs: fix iclog allocation size Christoph Hellwig
@ 2019-06-27 15:13 ` Darrick J. Wong
  2019-06-28 22:02 ` Luis Chamberlain
  1 sibling, 0 replies; 7+ messages in thread
From: Darrick J. Wong @ 2019-06-27 15:13 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-xfs, syzbot+b75afdbe271a0d7ac4f6

On Thu, Jun 27, 2019 at 04:39:50PM +0200, Christoph Hellwig wrote:
> Properly allocate the space for the bio_vecs instead of just one byte
> per bio_vec.
> 
> Fixes: 991fc1d2e65e ("xfs: use bios directly to write log buffers")
> Reported-by: syzbot+b75afdbe271a0d7ac4f6@syzkaller.appspotmail.com
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Doh....

Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_log.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> index 0f849b4095d6..e230f3c18ceb 100644
> --- a/fs/xfs/xfs_log.c
> +++ b/fs/xfs/xfs_log.c
> @@ -1415,7 +1415,8 @@ xlog_alloc_log(
>  	 */
>  	ASSERT(log->l_iclog_size >= 4096);
>  	for (i = 0; i < log->l_iclog_bufs; i++) {
> -		size_t bvec_size = howmany(log->l_iclog_size, PAGE_SIZE);
> +		size_t bvec_size = howmany(log->l_iclog_size, PAGE_SIZE) *
> +				sizeof(struct bio_vec);
>  
>  		iclog = kmem_zalloc(sizeof(*iclog) + bvec_size, KM_MAYFAIL);
>  		if (!iclog)
> -- 
> 2.20.1
> 

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

* Re: [PATCH] xfs: fix iclog allocation size
  2019-06-27 14:39 [PATCH] xfs: fix iclog allocation size Christoph Hellwig
  2019-06-27 15:13 ` Darrick J. Wong
@ 2019-06-28 22:02 ` Luis Chamberlain
  2019-06-28 22:19   ` Darrick J. Wong
  1 sibling, 1 reply; 7+ messages in thread
From: Luis Chamberlain @ 2019-06-28 22:02 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-xfs, syzbot+b75afdbe271a0d7ac4f6

On Thu, Jun 27, 2019 at 04:39:50PM +0200, Christoph Hellwig wrote:
> Properly allocate the space for the bio_vecs instead of just one byte
> per bio_vec.
> 
> Fixes: 991fc1d2e65e ("xfs: use bios directly to write log buffers")

I cannot find 991fc1d2e65e on Linus' tree, nor can I find the subject
name patch on Linus' tree. I'm probably missing some context here?

> Reported-by: syzbot+b75afdbe271a0d7ac4f6@syzkaller.appspotmail.com
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/xfs/xfs_log.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> index 0f849b4095d6..e230f3c18ceb 100644
> --- a/fs/xfs/xfs_log.c
> +++ b/fs/xfs/xfs_log.c
> @@ -1415,7 +1415,8 @@ xlog_alloc_log(
>  	 */
>  	ASSERT(log->l_iclog_size >= 4096);
>  	for (i = 0; i < log->l_iclog_bufs; i++) {
> -		size_t bvec_size = howmany(log->l_iclog_size, PAGE_SIZE);
> +		size_t bvec_size = howmany(log->l_iclog_size, PAGE_SIZE) *
> +				sizeof(struct bio_vec);
>  
>  		iclog = kmem_zalloc(sizeof(*iclog) + bvec_size, KM_MAYFAIL);
>  		if (!iclog)
> -- 
> 2.20.1
> 

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

* Re: [PATCH] xfs: fix iclog allocation size
  2019-06-28 22:02 ` Luis Chamberlain
@ 2019-06-28 22:19   ` Darrick J. Wong
  2019-06-28 22:23     ` Luis Chamberlain
  0 siblings, 1 reply; 7+ messages in thread
From: Darrick J. Wong @ 2019-06-28 22:19 UTC (permalink / raw)
  To: Luis Chamberlain
  Cc: Christoph Hellwig, linux-xfs, syzbot+b75afdbe271a0d7ac4f6

On Fri, Jun 28, 2019 at 10:02:53PM +0000, Luis Chamberlain wrote:
> On Thu, Jun 27, 2019 at 04:39:50PM +0200, Christoph Hellwig wrote:
> > Properly allocate the space for the bio_vecs instead of just one byte
> > per bio_vec.
> > 
> > Fixes: 991fc1d2e65e ("xfs: use bios directly to write log buffers")
> 
> I cannot find 991fc1d2e65e on Linus' tree, nor can I find the subject
> name patch on Linus' tree. I'm probably missing some context here?

This patch fixes a bug in for-next. :)

--D

> > Reported-by: syzbot+b75afdbe271a0d7ac4f6@syzkaller.appspotmail.com
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > ---
> >  fs/xfs/xfs_log.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> > index 0f849b4095d6..e230f3c18ceb 100644
> > --- a/fs/xfs/xfs_log.c
> > +++ b/fs/xfs/xfs_log.c
> > @@ -1415,7 +1415,8 @@ xlog_alloc_log(
> >  	 */
> >  	ASSERT(log->l_iclog_size >= 4096);
> >  	for (i = 0; i < log->l_iclog_bufs; i++) {
> > -		size_t bvec_size = howmany(log->l_iclog_size, PAGE_SIZE);
> > +		size_t bvec_size = howmany(log->l_iclog_size, PAGE_SIZE) *
> > +				sizeof(struct bio_vec);
> >  
> >  		iclog = kmem_zalloc(sizeof(*iclog) + bvec_size, KM_MAYFAIL);
> >  		if (!iclog)
> > -- 
> > 2.20.1
> > 

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

* Re: [PATCH] xfs: fix iclog allocation size
  2019-06-28 22:19   ` Darrick J. Wong
@ 2019-06-28 22:23     ` Luis Chamberlain
  2019-06-28 22:25       ` Darrick J. Wong
  0 siblings, 1 reply; 7+ messages in thread
From: Luis Chamberlain @ 2019-06-28 22:23 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Christoph Hellwig, linux-xfs, syzbot+b75afdbe271a0d7ac4f6

On Fri, Jun 28, 2019 at 03:19:14PM -0700, Darrick J. Wong wrote:
> On Fri, Jun 28, 2019 at 10:02:53PM +0000, Luis Chamberlain wrote:
> > On Thu, Jun 27, 2019 at 04:39:50PM +0200, Christoph Hellwig wrote:
> > > Properly allocate the space for the bio_vecs instead of just one byte
> > > per bio_vec.
> > > 
> > > Fixes: 991fc1d2e65e ("xfs: use bios directly to write log buffers")
> > 
> > I cannot find 991fc1d2e65e on Linus' tree, nor can I find the subject
> > name patch on Linus' tree. I'm probably missing some context here?
> 
> This patch fixes a bug in for-next. :)

I figured as much but the commit in question is not even on linux-next
for today, so I take it that line would be removed from the commit log?

  Luis

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

* Re: [PATCH] xfs: fix iclog allocation size
  2019-06-28 22:23     ` Luis Chamberlain
@ 2019-06-28 22:25       ` Darrick J. Wong
  2019-06-28 22:32         ` Luis Chamberlain
  0 siblings, 1 reply; 7+ messages in thread
From: Darrick J. Wong @ 2019-06-28 22:25 UTC (permalink / raw)
  To: Luis Chamberlain
  Cc: Christoph Hellwig, linux-xfs, syzbot+b75afdbe271a0d7ac4f6

On Fri, Jun 28, 2019 at 10:23:10PM +0000, Luis Chamberlain wrote:
> On Fri, Jun 28, 2019 at 03:19:14PM -0700, Darrick J. Wong wrote:
> > On Fri, Jun 28, 2019 at 10:02:53PM +0000, Luis Chamberlain wrote:
> > > On Thu, Jun 27, 2019 at 04:39:50PM +0200, Christoph Hellwig wrote:
> > > > Properly allocate the space for the bio_vecs instead of just one byte
> > > > per bio_vec.
> > > > 
> > > > Fixes: 991fc1d2e65e ("xfs: use bios directly to write log buffers")
> > > 
> > > I cannot find 991fc1d2e65e on Linus' tree, nor can I find the subject
> > > name patch on Linus' tree. I'm probably missing some context here?
> > 
> > This patch fixes a bug in for-next. :)
> 
> I figured as much but the commit in question is not even on linux-next
> for today, so I take it that line would be removed from the commit log?

It looks like it is to me...

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20190628&id=991fc1d2e65e381fe8db9038d9a139d45c948f4f

--D

>   Luis

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

* Re: [PATCH] xfs: fix iclog allocation size
  2019-06-28 22:25       ` Darrick J. Wong
@ 2019-06-28 22:32         ` Luis Chamberlain
  0 siblings, 0 replies; 7+ messages in thread
From: Luis Chamberlain @ 2019-06-28 22:32 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Christoph Hellwig, linux-xfs, syzbot+b75afdbe271a0d7ac4f6

On Fri, Jun 28, 2019 at 03:25:48PM -0700, Darrick J. Wong wrote:
> On Fri, Jun 28, 2019 at 10:23:10PM +0000, Luis Chamberlain wrote:
> > On Fri, Jun 28, 2019 at 03:19:14PM -0700, Darrick J. Wong wrote:
> > > On Fri, Jun 28, 2019 at 10:02:53PM +0000, Luis Chamberlain wrote:
> > > > On Thu, Jun 27, 2019 at 04:39:50PM +0200, Christoph Hellwig wrote:
> > > > > Properly allocate the space for the bio_vecs instead of just one byte
> > > > > per bio_vec.
> > > > > 
> > > > > Fixes: 991fc1d2e65e ("xfs: use bios directly to write log buffers")
> > > > 
> > > > I cannot find 991fc1d2e65e on Linus' tree, nor can I find the subject
> > > > name patch on Linus' tree. I'm probably missing some context here?
> > > 
> > > This patch fixes a bug in for-next. :)
> > 
> > I figured as much but the commit in question is not even on linux-next
> > for today, so I take it that line would be removed from the commit log?
> 
> It looks like it is to me...
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20190628&id=991fc1d2e65e381fe8db9038d9a139d45c948f4f

Yes but commits on linux-next make no sense for Linus' tree, as they change
day to day, is my point. So if merged eventually as-is on Linus' tree,
someone looking at the git history would not find 991fc1d2e65e, and
could also throw errors on scripts which scrape for these tags. Yes,
they exist, and distros do use them to evaluate possible fixes.

In this case I think just referring to the subject would do it.

Unless it just so happens to be that what is on for-next *does* always
maintain the same commit IDs one it goes to Linus' tree? Does that
actually happen?

  Luis

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

end of thread, other threads:[~2019-06-28 22:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-27 14:39 [PATCH] xfs: fix iclog allocation size Christoph Hellwig
2019-06-27 15:13 ` Darrick J. Wong
2019-06-28 22:02 ` Luis Chamberlain
2019-06-28 22:19   ` Darrick J. Wong
2019-06-28 22:23     ` Luis Chamberlain
2019-06-28 22:25       ` Darrick J. Wong
2019-06-28 22:32         ` Luis Chamberlain

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).