Skip to contentSkip to conversation

btrfs: Fix return value of read_extent_buffer_pages() when lock page failed

PATCH In review Miao Xie 3 participants 3 messages Mar 25, 2010 – Mar 31, 2010 Btrfs file system

lore
Share & tools
lore

Miao Xie

author
#0 lore raw

PATCH 9/18 btrfs: Fix return value of read_extent_buffer_pages() when lock page failed

From: Zhao Lei <[email protected]>

read_extent_buffer_pages() should return error value instead of 0 when lock page failed, we fix this problem.

---
 fs/btrfs/extent_io.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
fs/btrfs/extent_io.c +3 -1
index bdfbfa6..3194c79 100644
@@ -3419,8 +3419,10 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
 	for (i = start_i; i < num_pages; i++) {
 		page = extent_buffer_page(eb, i);
 		if (!wait) {
-			if (!trylock_page(page))
+			if (!trylock_page(page)) {
+				ret = -EIO;
 				goto unlock_exit;
+			}
 		} else {
 			lock_page(page);
 		}
Signature · 1 line
1.6.5.2
#1 lore raw
Quoted 4 lines · Miao Xie

From: Zhao Lei <[email protected]>

read_extent_buffer_pages() should return error value instead of 0 when lock page failed, we fix this problem.

[ Thanks for all of these patches! ]

This isn't strictly an IO error, the caller has said they are not willing to wait, so we don't wait. That's different from finding a page where the IO had failed.

In general we ignore the errors until the caller is willing to wait for the result.

-chris

Quoted 31 lines
---
 fs/btrfs/extent_io.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
fs/btrfs/extent_io.c +3 -1
index bdfbfa6..3194c79 100644
@@ -3419,8 +3419,10 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
 	for (i = start_i; i < num_pages; i++) {
 		page = extent_buffer_page(eb, i);
 		if (!wait) {
-			if (!trylock_page(page))
+			if (!trylock_page(page)) {
+				ret = -EIO;
 				goto unlock_exit;
+			}
 		} else {
 			lock_page(page);
 		}
Signature · 7 lines
1.6.5.2


--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
Quoted 8 lines · Chris Mason
Quoted 4 lines · Miao Xie

From: Zhao Lei <[email protected]>

read_extent_buffer_pages() should return error value instead of 0 when lock page failed, we fix this problem.

[ Thanks for all of these patches! ]

Quoted 8 lines

This isn't strictly an IO error, the caller has said they are not willing to wait, so we don't wait. That's different from finding a page where the IO had failed.

In general we ignore the errors until the caller is willing to wait for the result.

-chris

Hello, chris

Thanks for your response.
I'll drop this patch.

Thanks
Zhaolei

Quoted 35 lines
Quoted 30 lines
---
 fs/btrfs/extent_io.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
fs/btrfs/extent_io.c +3 -1
index bdfbfa6..3194c79 100644
@@ -3419,8 +3419,10 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
 	for (i = start_i; i < num_pages; i++) {
 		page = extent_buffer_page(eb, i);
 		if (!wait) {
-			if (!trylock_page(page))
+			if (!trylock_page(page)) {
+				ret = -EIO;
 				goto unlock_exit;
+			}
 		} else {
 			lock_page(page);
 		}
Signature · 7 lines
1.6.5.2


--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html