From: Eric Sandeen <sandeen@redhat.com>
To: Kalpak Shah <Kalpak.Shah@Sun.COM>
Cc: Andreas Dilger <adilger@Sun.COM>,
Eric Sandeen <sandeen@sandeen.net>,
Jeremy Fitzhardinge <jeremy@goop.org>,
linux-ext4@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: ext4 deadlocks
Date: Wed, 08 Oct 2008 09:57:35 -0500 [thread overview]
Message-ID: <48ECCA5F.4070905@redhat.com> (raw)
In-Reply-To: <1223441351.4007.137.camel@localhost>
Kalpak Shah wrote:
> ext4_xattr_set_handle() eventually ends up calling
> ext4_mark_inode_dirty() which tries to expand the inode by shifting the
> EAs. This leads to the xattr_sem being downed again and leading to a
> deadlock.
>
> This patch makes sure that if ext4_xattr_set_handle() is in the
> call-chain, ext4_mark_inode_dirty() will not expand the inode.
>
> Signed-off-by: Kalpak Shah <kalpak.shah@sun.com>
Yes, this fixes my testcase. Thanks, Kalpak.
-Eric
> Index: linux-2.6.27-rc7/fs/ext4/xattr.c
> ===================================================================
> --- linux-2.6.27-rc7.orig/fs/ext4/xattr.c
> +++ linux-2.6.27-rc7/fs/ext4/xattr.c
> @@ -959,6 +959,7 @@ ext4_xattr_set_handle(handle_t *handle,
> struct ext4_xattr_block_find bs = {
> .s = { .not_found = -ENODATA, },
> };
> + unsigned long no_expand;
> int error;
>
> if (!name)
> @@ -966,6 +967,9 @@ ext4_xattr_set_handle(handle_t *handle,
> if (strlen(name) > 255)
> return -ERANGE;
> down_write(&EXT4_I(inode)->xattr_sem);
> + no_expand = EXT4_I(inode)->i_state & EXT4_STATE_NO_EXPAND;
> + EXT4_I(inode)->i_state |= EXT4_STATE_NO_EXPAND;
> +
> error = ext4_get_inode_loc(inode, &is.iloc);
> if (error)
> goto cleanup;
> @@ -1042,6 +1046,8 @@ ext4_xattr_set_handle(handle_t *handle,
> cleanup:
> brelse(is.iloc.bh);
> brelse(bs.bh);
> + if (no_expand == 0)
> + EXT4_I(inode)->i_state &= ~EXT4_STATE_NO_EXPAND;
> up_write(&EXT4_I(inode)->xattr_sem);
> return error;
> }
>
> Thanks,
> Kalpak
>
> --
> 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
prev parent reply other threads:[~2008-10-08 14:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-07 19:35 ext4 deadlocks Jeremy Fitzhardinge
2008-10-07 20:29 ` Eric Sandeen
2008-10-07 21:27 ` Eric Sandeen
2008-10-07 21:54 ` Jeremy Fitzhardinge
2008-10-07 21:46 ` Andreas Dilger
2008-10-08 4:49 ` Kalpak Shah
2008-10-08 14:57 ` Eric Sandeen [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=48ECCA5F.4070905@redhat.com \
--to=sandeen@redhat.com \
--cc=Kalpak.Shah@Sun.COM \
--cc=adilger@Sun.COM \
--cc=jeremy@goop.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sandeen@sandeen.net \
/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).