From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Jan Kara <jack@suse.cz>
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu, chris.mason@oracle.com
Subject: Re: [PATCH 4/4] ext4: Wait for proper transaction commit on fsync
Date: Tue, 20 Oct 2009 18:01:31 +0530 [thread overview]
Message-ID: <20091020123131.GA30182@skywalker.linux.vnet.ibm.com> (raw)
In-Reply-To: <1256023478-746-5-git-send-email-jack@suse.cz>
On Tue, Oct 20, 2009 at 09:24:38AM +0200, Jan Kara wrote:
> We cannot rely on buffer dirty bits during fsync because pdflush can come
> before fsync is called and clear dirty bits without forcing a transaction
> commit. What we do is that we track which transaction has last changed
> the inode and which transaction last changed allocation and force it to
> disk on fsync.
>
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
> fs/ext4/ext4.h | 7 +++++++
> fs/ext4/extents.c | 5 +++++
> fs/ext4/fsync.c | 40 +++++++++++++++++-----------------------
> fs/ext4/inode.c | 34 ++++++++++++++++++++++++++++++++++
> 4 files changed, 63 insertions(+), 23 deletions(-)
>
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index 984ca0c..5639f30 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -702,6 +702,13 @@ struct ext4_inode_info {
> struct list_head i_aio_dio_complete_list;
> /* current io_end structure for async DIO write*/
> ext4_io_end_t *cur_aio_dio;
> +
> + /*
> + * Transactions that contain inode's metadata needed to complete
> + * fsync and fdatasync, respectively.
> + */
> + atomic_t i_sync_tid;
> + atomic_t i_datasync_tid;
> };
>
> /*
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index 10539e3..3e167f6 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -3315,6 +3315,11 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
> newblock = ext_pblock(&newex);
> allocated = ext4_ext_get_actual_len(&newex);
> set_buffer_new(bh_result);
> +
> + atomic_set(&EXT4_I(inode)->i_sync_tid, handle->h_transaction->t_tid);
> + atomic_set(&EXT4_I(inode)->i_datasync_tid,
> + handle->h_transaction->t_tid);
> + printk("Datasync tid %u\n", handle->h_transaction->t_tid);
The printk need to be removed ?
Also i am wondering wether we need to update i_datasync_tid only if we
allocate new blocks ? How about writing to an fallocate area. I guess
we need to track the transaction in which we are marking an extent
initialized.
-aneesh
next prev parent reply other threads:[~2009-10-20 12:31 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-20 7:24 [PATCH 0/4] Fix fsync bug in ext3 and ext4 Jan Kara
2009-10-20 7:24 ` [PATCH 1/4] ext3: Wait for proper transaction commit on fsync Jan Kara
2009-10-20 7:24 ` [PATCH 2/4] ext4: Avoid issuing barriers on error recovery path Jan Kara
2009-10-20 7:24 ` [PATCH 3/4] ext4: Fix error handling ext4_ind_get_blocks Jan Kara
2009-10-20 7:24 ` [PATCH 4/4] ext4: Wait for proper transaction commit on fsync Jan Kara
2009-10-20 12:31 ` Aneesh Kumar K.V [this message]
2009-10-20 16:05 ` Jan Kara
2009-10-20 14:36 ` Curt Wohlgemuth
2009-10-20 15:52 ` Jan Kara
-- strict thread matches above, loose matches on Subject: below --
2009-10-27 12:48 [PATCH 0/4] Fix fsync on ext3 and ext4 (v2) Jan Kara
2009-10-27 12:48 ` [PATCH 4/4] ext4: Wait for proper transaction commit on fsync Jan Kara
2009-11-04 14:57 ` Andi Kleen
2009-11-04 15:53 ` Jan Kara
2009-11-16 0:46 ` Theodore Tso
2009-11-16 10:43 ` Jan Kara
2009-12-09 3:51 ` tytso
2009-12-09 4:54 ` tytso
2009-12-09 11:29 ` Jan Kara
2009-12-09 14:32 ` tytso
2009-12-09 11:30 ` Jan Kara
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=20091020123131.GA30182@skywalker.linux.vnet.ibm.com \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=chris.mason@oracle.com \
--cc=jack@suse.cz \
--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).