Skip to contentSkip to conversation

xfs: fix iclog allocation size

PATCH In review Christoph Hellwig 3 participants 7 messages Jun 27, 2019 – Jun 28, 2019 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: fix iclog allocation size

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 [email protected]
---
 fs/xfs/xfs_log.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/xfs/xfs_log.c +2 -1
index 0f849b4095d6..e230f3c18ceb 100644
@@ -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)
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Christoph Hellwig

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 [email protected]

Doh....

--D

Quoted 21 lines
---
 fs/xfs/xfs_log.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/xfs/xfs_log.c +2 -1
index 0f849b4095d6..e230f3c18ceb 100644
@@ -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)
Signature · 1 line
2.20.1
#2 lore raw
In reply to Christoph Hellwig
Quoted 4 lines · Christoph Hellwig

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?

Quoted 23 lines
---
 fs/xfs/xfs_log.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/xfs/xfs_log.c +2 -1
index 0f849b4095d6..e230f3c18ceb 100644
@@ -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)
Signature · 1 line
2.20.1
#3 lore raw
Quoted 8 lines · Luis Chamberlain
Quoted 4 lines · Christoph Hellwig

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

Quoted 23 lines
Quoted 23 lines
---
 fs/xfs/xfs_log.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/xfs/xfs_log.c +2 -1
index 0f849b4095d6..e230f3c18ceb 100644
@@ -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)
Signature · 1 line
2.20.1
#4 lore raw
Quoted 11 lines · Darrick J. Wong
Quoted 8 lines · Luis Chamberlain
Quoted 4 lines · Christoph Hellwig

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

#5 lore raw
Quoted 8 lines · Luis Chamberlain
Quoted 7 lines · Darrick J. Wong
Quoted 6 lines · Luis Chamberlain
Quoted 4 lines · Christoph Hellwig

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")
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

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

Quoted 1 line

Luis

#6 lore raw
Quoted 12 lines · Darrick J. Wong
Quoted 11 lines · Luis Chamberlain
Quoted 10 lines · Darrick J. Wong
Quoted 8 lines · Luis Chamberlain
Quoted 4 lines · Christoph Hellwig

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?

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

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