* [Cluster-devel] [PATCH] gfs2: Fix extended attribute readahead optimization
@ 2016-08-18 15:52 Andreas Gruenbacher
2016-08-18 17:06 ` Bob Peterson
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Gruenbacher @ 2016-08-18 15:52 UTC (permalink / raw)
To: cluster-devel.redhat.com
Commit 39b0555f didn't check for a failing bio_add_page in
gfs2_submit_bhs. This could cause I/O requests to get lost, and the
affected buffer heads to stay locked forever. Fix that by submitting
the current bio and allocating another one when bio_add_page fails. (It
is guaranteed that we can at least add one page to a bio.)
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
fs/gfs2/meta_io.c | 35 +++++++++++++++++++----------------
1 file changed, 19 insertions(+), 16 deletions(-)
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index 950b8be..373639a5 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -216,23 +216,26 @@ static void gfs2_meta_read_endio(struct bio *bio)
static void gfs2_submit_bhs(int op, int op_flags, struct buffer_head *bhs[],
int num)
{
- struct buffer_head *bh = bhs[0];
- struct bio *bio;
- int i;
-
- if (!num)
- return;
-
- bio = bio_alloc(GFP_NOIO, num);
- bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9);
- bio->bi_bdev = bh->b_bdev;
- for (i = 0; i < num; i++) {
- bh = bhs[i];
- bio_add_page(bio, bh->b_page, bh->b_size, bh_offset(bh));
+ while (num > 0) {
+ struct buffer_head *bh = *bhs;
+ struct bio *bio;
+
+ bio = bio_alloc(GFP_NOIO, num);
+ bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9);
+ bio->bi_bdev = bh->b_bdev;
+ while (num > 0) {
+ bh = *bhs;
+ if (!bio_add_page(bio, bh->b_page, bh->b_size, bh_offset(bh))) {
+ BUG_ON(bio->bi_iter.bi_size == 0);
+ break;
+ }
+ bhs++;
+ num--;
+ }
+ bio->bi_end_io = gfs2_meta_read_endio;
+ bio_set_op_attrs(bio, op, op_flags);
+ submit_bio(bio);
}
- bio->bi_end_io = gfs2_meta_read_endio;
- bio_set_op_attrs(bio, op, op_flags);
- submit_bio(bio);
}
/**
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Cluster-devel] [PATCH] gfs2: Fix extended attribute readahead optimization
2016-08-18 15:52 [Cluster-devel] [PATCH] gfs2: Fix extended attribute readahead optimization Andreas Gruenbacher
@ 2016-08-18 17:06 ` Bob Peterson
2016-08-18 17:18 ` Andreas Gruenbacher
0 siblings, 1 reply; 3+ messages in thread
From: Bob Peterson @ 2016-08-18 17:06 UTC (permalink / raw)
To: cluster-devel.redhat.com
----- Original Message -----
| Commit 39b0555f didn't check for a failing bio_add_page in
| gfs2_submit_bhs. This could cause I/O requests to get lost, and the
| affected buffer heads to stay locked forever. Fix that by submitting
| the current bio and allocating another one when bio_add_page fails. (It
| is guaranteed that we can at least add one page to a bio.)
|
| Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
| ---
| fs/gfs2/meta_io.c | 35 +++++++++++++++++++----------------
| 1 file changed, 19 insertions(+), 16 deletions(-)
Hi,
Thanks. This is now applied to the for-next branch of the linux-gfs2 tree:
https://git.kernel.org/cgit/linux/kernel/git/gfs2/linux-gfs2.git/commit/fs/gfs2?h=for-next&id=23e5671a79be00b2f1c895aa93ff40fb75a4647e
Regards,
Bob Peterson
Red Hat File Systems
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Cluster-devel] [PATCH] gfs2: Fix extended attribute readahead optimization
2016-08-18 17:06 ` Bob Peterson
@ 2016-08-18 17:18 ` Andreas Gruenbacher
0 siblings, 0 replies; 3+ messages in thread
From: Andreas Gruenbacher @ 2016-08-18 17:18 UTC (permalink / raw)
To: cluster-devel.redhat.com
On Thu, Aug 18, 2016 at 7:06 PM, Bob Peterson <rpeterso@redhat.com> wrote:
> ----- Original Message -----
> | Commit 39b0555f didn't check for a failing bio_add_page in
> | gfs2_submit_bhs. This could cause I/O requests to get lost, and the
> | affected buffer heads to stay locked forever. Fix that by submitting
> | the current bio and allocating another one when bio_add_page fails. (It
> | is guaranteed that we can at least add one page to a bio.)
> |
> | Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
> | ---
> | fs/gfs2/meta_io.c | 35 +++++++++++++++++++----------------
> | 1 file changed, 19 insertions(+), 16 deletions(-)
>
> Hi,
>
> Thanks. This is now applied to the for-next branch of the linux-gfs2 tree:
> https://git.kernel.org/cgit/linux/kernel/git/gfs2/linux-gfs2.git/commit/fs/gfs2?h=for-next&id=23e5671a79be00b2f1c895aa93ff40fb75a4647e
Should this fix be pushed upstream for 4.8 as well?
Thanks,
Andreas
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-08-18 17:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-18 15:52 [Cluster-devel] [PATCH] gfs2: Fix extended attribute readahead optimization Andreas Gruenbacher
2016-08-18 17:06 ` Bob Peterson
2016-08-18 17:18 ` Andreas Gruenbacher
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.