linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Dave Jones <davej@redhat.com>
Cc: Jan Kara <jack@suse.cz>, Ted Tso <tytso@mit.edu>,
	linux-ext4@vger.kernel.org, Zheng Liu <gnehzuil.liu@gmail.com>
Subject: Re: [PATCH] ext4: Make ext4_writepages() resilient to i_size changes
Date: Fri, 2 Aug 2013 21:15:37 +0200	[thread overview]
Message-ID: <20130802191537.GA25558@quack.suse.cz> (raw)
In-Reply-To: <20130802152624.GA1121@redhat.com>

On Fri 02-08-13 11:26:24, Dave Jones wrote:
> On Fri, Aug 02, 2013 at 04:23:24PM +0200, Jan Kara wrote:
>  > On Thu 01-08-13 00:42:12, Jan Kara wrote:
>  > > Inode size can arbitrarily change while writeback is in progress. This
>  > > can have various strange effects when we use one value of i_size for one
>  > > decision during writeback and another value of i_size for a different
>  > > decision during writeback. In particular a check for lblk < blocks in
>  > > mpage_map_and_submit_buffers() causes problems when i_size is reduced
>  > > while writeback is running because we can end up not using all blocks
>  > > we've allocated. Thus these blocks are leaked and also delalloc
>  > > accounting gets wrong manifesting as a warning like:
>  > > 
>  > > ext4_da_release_space:1333: ext4_da_release_space: ino 12, to_free 1
>  > > with only 0 reserved data blocks
>  > > 
>  > > The problem can happen only when blocksize < pagesize because the check
>  > > for size is performed only after the first iteration of the mapping
>  > > loop.
>  > > 
>  > > Fix the problem by removing the size check from the mapping loop. We
>  > > have an extent allocated so we have to use it all before checking for
>  > > i_size. We may call add_page_bufs_to_extent() unnecessarily but that
>  > > function won't do anything if passed block number is beyond file size.
>  > > 
>  > > Also to avoid future surprises like this sample inode size when
>  > > starting writeback in ext4_writepages() and then use this sampled size
>  > > throughout the writeback call stack.
>  >   Ted, please disregard this patch. It is buggy. I'll send a better fix
>  > soon.
>  
> I was about to post that I was seeing fsx failures on 1k filesystems
> on a kernel with this patch.
> 
> Is that the same thing you're seeing ?
  Likely, I saw fsstress failures with it. But fsx would likely fail as
well - the writing of tail page was hosed.

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

      reply	other threads:[~2013-08-02 19:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-31 22:42 [PATCH] ext4: Make ext4_writepages() resilient to i_size changes Jan Kara
2013-08-02 14:23 ` Jan Kara
2013-08-02 15:26   ` Dave Jones
2013-08-02 19:15     ` Jan Kara [this message]

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=20130802191537.GA25558@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=davej@redhat.com \
    --cc=gnehzuil.liu@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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).