Skip to contentSkip to conversation

fs: direct-io: fix missing sdio->boundary

PATCH In review Jack Qiu 3 participants 3 messages Mar 22, 2021 – Mar 28, 2021 VFS

lore
Share & tools
lore

Jack Qiu

author
#0 lore raw

PATCH 1/1 fs: direct-io: fix missing sdio->boundary

Function dio_send_cur_page may clear sdio->boundary, so save it to avoid boundary missing.

Fixes b1058b981272 ("direct-io: submit bio after boundary buffer is

added to it")

---
 fs/direct-io.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/direct-io.c +3 -2
index 9fe721dc04e0..c9023f0bb20a 100644
@@ -812,6 +812,7 @@ submit_page_section(struct dio *dio, struct dio_submit *sdio, struct page *page,
 		    struct buffer_head *map_bh)
 {
 	int ret = 0;
+	int boundary = sdio->boundary;	/* dio_send_cur_page may clear it */
 
 	if (dio->op == REQ_OP_WRITE) {
 		/*
@@ -850,10 +851,10 @@ submit_page_section(struct dio *dio, struct dio_submit *sdio, struct page *page,
 	sdio->cur_page_fs_offset = sdio->block_in_file << sdio->blkbits;
 out:
 	/*
-	 * If sdio->boundary then we want to schedule the IO now to
+	 * If boundary then we want to schedule the IO now to
 	 * avoid metadata seeks.
 	 */
-	if (sdio->boundary) {
+	if (boundary) {
 		ret = dio_send_cur_page(dio, sdio, map_bh);
 		if (sdio->bio)
 			dio_bio_submit(dio, sdio);

--
2.17.1

reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Jack Qiu

Function dio_send_cur_page may clear sdio->boundary, so save it to avoid boundary missing.

Fixes b1058b981272 ("direct-io: submit bio after boundary buffer is

added to it")

Indeed. The patch looks good to me. Feel free to add:

Honza

Quoted 32 lines
---
 fs/direct-io.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/direct-io.c +3 -3
index 9fe721dc04e0..c9023f0bb20a 100644
@@ -812,6 +812,7 @@ submit_page_section(struct dio *dio, struct dio_submit *sdio, struct page *page,
 		    struct buffer_head *map_bh)
 {
 	int ret = 0;
+	int boundary = sdio->boundary;	/* dio_send_cur_page may clear it */
 
 	if (dio->op == REQ_OP_WRITE) {
 		/*
@@ -850,10 +851,10 @@ submit_page_section(struct dio *dio, struct dio_submit *sdio, struct page *page,
 	sdio->cur_page_fs_offset = sdio->block_in_file << sdio->blkbits;
 out:
 	/*
-	 * If sdio->boundary then we want to schedule the IO now to
+	 * If boundary then we want to schedule the IO now to
 	 * avoid metadata seeks.
 	 */
-	if (sdio->boundary) {
+	if (boundary) {
 		ret = dio_send_cur_page(dio, sdio, map_bh);
 		if (sdio->bio)
 			dio_bio_submit(dio, sdio);
--

2.17.1

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#2 lore raw
Quoted 4 lines · On Mon, 22 Mar 2021 12:28:47 +0100 Jan Kara <[email protected]> wrote:
Quoted 3 lines · Jack Qiu

Function dio_send_cur_page may clear sdio->boundary, so save it to avoid boundary missing.

Quoted 8 lines
Quoted 4 lines
Fixes b1058b981272 ("direct-io: submit bio after boundary buffer is

added to it")

Indeed. The patch looks good to me. Feel free to add:

It's been 8 years and nobody has noticed. I'm struggling to see the cc:stable justification here. Do we have any performance measurements which would justify backporting?