From: Eric Sandeen <sandeen@redhat.com>
To: ext4 development <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH 2/2 V2] ext4: don't bump nr_to_write if LONG_MAX
Date: Fri, 03 Sep 2010 16:37:48 -0500 [thread overview]
Message-ID: <4C816AAC.4090709@redhat.com> (raw)
In-Reply-To: <4C7D0FAB.9070501@redhat.com>
Eric Sandeen wrote:
> In some cases we can reach ext4_da_writepages() with
> wbc->nr_to_write == LONG_MAX, !range_cyclic, and range_whole=1;
> in this case we will try to bump it up by a factor of 8, which
> leads to a desired_nr_to_write value of -8.
Sorry Ted, hold off on this, it should have been LLONG_MAX of course,
and I'm still looking for one other bit of brokennes I see.
The 1/2 patch should be good though.
-Eric
> We still get through the logic without actually changing
> wbc->nr_to_write because the other tests which would change
> it don't trip due to the negative value, but it seems dangerous
> to overflow desired_nr_to_write in the interim, it's not an
> obvious situation.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> (V2 minor commit message edits)
>
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 93497f6..2e72a4a 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -3004,9 +3004,11 @@ static int ext4_da_writepages(struct address_space *mapping,
> * sbi->max_writeback_mb_bump whichever is smaller.
> */
> max_pages = sbi->s_max_writeback_mb_bump << (20 - PAGE_CACHE_SHIFT);
> - if (!range_cyclic && range_whole)
> - desired_nr_to_write = wbc->nr_to_write * 8;
> - else
> + if (!range_cyclic && range_whole) {
> + desired_nr_to_write = wbc->nr_to_write;
> + if (desired_nr_to_write != LONG_MAX)
> + desired_nr_to_write *= 8;
> + } else
> desired_nr_to_write = ext4_num_dirty_pages(inode, index,
> max_pages);
> if (desired_nr_to_write > max_pages)
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-09-03 21:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-31 13:56 [PATCH 0/2] ext4: a couple writeback path fixes Eric Sandeen
2010-08-31 13:59 ` PATCH 1/2] ext4: stop looping in ext4_num_dirty_pages when max_pages reached Eric Sandeen
2010-08-31 14:04 ` [PATCH 2/2] ext4: don't bump nr_to_write if LONG_MAX Eric Sandeen
2010-08-31 14:20 ` [PATCH 2/2 V2] " Eric Sandeen
2010-09-03 21:37 ` Eric Sandeen [this message]
2010-09-03 22:11 ` [PATCH 0/2] ext4: a couple writeback path fixes Eric Sandeen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C816AAC.4090709@redhat.com \
--to=sandeen@redhat.com \
--cc=linux-ext4@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).