From: Zheng Liu <gnehzuil.liu@gmail.com>
To: Theodore Ts'o <tytso@mit.edu>
Cc: linux-ext4@vger.kernel.org, Zheng Liu <wenqing.lz@taobao.com>
Subject: Re: [PATCH] ext4: take i_mutex in ext4_symlink to eliminate a warning from ext4_truncate
Date: Wed, 27 Mar 2013 23:35:06 +0800 [thread overview]
Message-ID: <20130327153506.GA4565@gmail.com> (raw)
In-Reply-To: <20130327151248.GE14900@thunk.org>
On Wed, Mar 27, 2013 at 11:12:48AM -0400, Theodore Ts'o wrote:
> On Wed, Mar 27, 2013 at 11:19:22PM +0800, Zheng Liu wrote:
> > > > Otherwise, couldn't we end up with problems where a failed write calls
> > > > ext4_truncate() without i_data_sem(), and that races with something
> > > > else --- say, a punch or truncate call to that same inode?
> >
> > Let me think about it. I need to take a close look at it.
>
> Note that I'm not so concerned when we are creating symlink --- you
> are quite right in pointing out in that case the inode isn't in the
> namespace yet, so that prevents races --- but also what might happen
> in an ENOSPC write(2) failure racing against a punch/truncate call.
>
> But again, this is why I added the warning --- it was to find these
> edge cases that we might not have considered. :-)
ext4_truncate_failed_write() is called by the following functions:
- ext4_ind_direct_IO
- ext4_convert_inline_data_to_extent
- ext4_da_convert_inline_data_to_extent
- ext4_write_begin
- ext4_write_end
- ext4_journalled_write_end
- ext4_da_write_begin
All these functions are protected by i_mutex. So we can serialize it
with truncate/punch hole.
Regards,
- Zheng
next prev parent reply other threads:[~2013-03-27 15:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-27 13:19 [PATCH] ext4: take i_mutex in ext4_symlink to eliminate a warning from ext4_truncate Zheng Liu
2013-03-27 13:41 ` Theodore Ts'o
2013-03-27 14:02 ` Zheng Liu
2013-03-27 13:51 ` Theodore Ts'o
2013-03-27 15:07 ` Zheng Liu
2013-03-27 15:19 ` Zheng Liu
2013-03-27 15:12 ` Theodore Ts'o
2013-03-27 15:35 ` Zheng Liu [this message]
2013-03-28 14:06 ` Theodore Ts'o
2013-04-01 15:23 ` [PATCH] fs: take i_mutex in __page_symlink() Theodore Ts'o
2013-04-01 16:35 ` Al Viro
2013-04-01 17:38 ` Theodore Ts'o
2013-04-02 8:19 ` Dmitry Monakhov
2013-03-27 14:04 ` [PATCH] ext4: take i_mutex in ext4_symlink to eliminate a warning from ext4_truncate Zheng Liu
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=20130327153506.GA4565@gmail.com \
--to=gnehzuil.liu@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=wenqing.lz@taobao.com \
/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 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.