linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Miklos Szeredi <mszeredi@suse.cz>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Toshiyuki Okajima <toshi.okajima@jp.fujitsu.com>
Subject: Re: [git pull] vfs pile 1
Date: Sun, 8 Jan 2012 23:50:40 +0000	[thread overview]
Message-ID: <20120108235039.GQ23916@ZenIV.linux.org.uk> (raw)
In-Reply-To: <CA+55aFw+7xvfP3NCr5p2Ma--UTb7zT+QQxtjCn3V2SU_g3LUdA@mail.gmail.com>

On Sun, Jan 08, 2012 at 03:04:30PM -0800, Linus Torvalds wrote:
> Hmm.
> 
> Al, Miklos, I just triggered the new inc_link() warning three times in
> very close succession by just doing a simple
> 
>               perf record -f -e cycles:pp make -j
> 
> (I don't think the "perf record" part was actually required or
> relevant, although it may have been instrumental in triggering just
> the right timing)
> 
> This was in a fully built tree, I'm just checking
> 
> The warning trace looks like this:
> 
>   [ 6933.446125] ------------[ cut here ]------------
>   [ 6933.446131] WARNING: at fs/inode.c:349 inc_nlink+0x30/0x40()
>   [ 6933.446133] Hardware name: System Product Name
>   [ 6933.446135] Pid: 22955, comm: perf Not tainted
> 3.2.0-03190-g972b2c719990 #72
>   [ 6933.446137] Call Trace:
>   [ 6933.446143]  [<ffffffff8102ee15>] warn_slowpath_common+0x75/0xb0
>   [ 6933.446145]  [<ffffffff8102ef15>] warn_slowpath_null+0x15/0x20
>   [ 6933.446147]  [<ffffffff810f1450>] inc_nlink+0x30/0x40
>   [ 6933.446151]  [<ffffffff8116f333>] ext4_symlink+0x113/0x2c0
>   [ 6933.446154]  [<ffffffff810e7b01>] vfs_symlink+0xa1/0xf0
>   [ 6933.446157]  [<ffffffff810e7c03>] sys_symlinkat+0xb3/0xd0
>   [ 6933.446159]  [<ffffffff810e7c31>] sys_symlink+0x11/0x20
>   [ 6933.446162]  [<ffffffff816916a2>] system_call_fastpath+0x16/0x1b
>   [ 6933.446164] ---[ end trace 550d4b2eb6b8fbc9 ]---
> 
> and the three warnings all triggered within 2/100th of a second of
> that one (the last one had a timestamp of 6933.465678), so they are
> probably all related to the same thing happening.

WTF is ext4_symlink() doing in case of long symlinks?  Look:
                drop_nlink(inode);
                err = ext4_orphan_add(handle, inode);
                ext4_journal_stop(handle);
[write symlink body]
                inc_nlink(inode);
                err = ext4_orphan_del(handle, inode);
oh, I see...  The comment above that re deadlocks and inability to do that
in a single transaction ;-/

OK, try this; that's equivalent to what they are doing and will not WARN_ON();
I hadn't checked other filesystems for similar tricks yet, so this has a good
chance of being incomplete.

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 86edc45..2043f48 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2315,7 +2315,7 @@ retry:
 			err = PTR_ERR(handle);
 			goto err_drop_inode;
 		}
-		inc_nlink(inode);
+		set_nlink(inode, 1);
 		err = ext4_orphan_del(handle, inode);
 		if (err) {
 			ext4_journal_stop(handle);

  reply	other threads:[~2012-01-08 23:50 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-05  2:23 [git pull] vfs pile 1 Al Viro
2012-01-08 23:04 ` Linus Torvalds
2012-01-08 23:50   ` Al Viro [this message]
2012-01-08 23:53     ` Al Viro
2012-01-09  0:11       ` Linus Torvalds
2012-01-09  0:25         ` Al Viro
2012-01-09  0:39           ` Linus Torvalds
2012-01-09  2:12             ` Al Viro
2012-01-09 15:11     ` Ted Ts'o
2012-01-11 11:58   ` Christoph Hellwig
2012-01-11 12:36     ` Miklos Szeredi
2012-01-11 12:40       ` Christoph Hellwig
2012-01-11 13:12         ` Miklos Szeredi
2012-01-11 15:23           ` Ted Ts'o
2012-01-11 16:19             ` Al Viro
2012-01-12 11:41               ` Miklos Szeredi
  -- strict thread matches above, loose matches on Subject: below --
2018-06-04  0:59 [git pull] vfs, " Al Viro
2016-12-16 13:30 [git pull] vfs " Al Viro
2015-09-06  2:55 Al Viro
2015-06-22  6:47 Al Viro
2014-01-27 14:25 Al Viro
2014-01-27 23:05 ` Stephen Rothwell
2014-01-29  3:26 ` Linus Torvalds
2014-01-29 13:37   ` Jan Kara
2014-01-30  2:02     ` Kim Jaegeuk
2014-01-30 15:26       ` Jan Kara
2014-01-30 13:07   ` Christoph Hellwig
2013-02-27  3:24 Al Viro
2012-03-21  3:31 Al Viro
2011-05-26 11:53 Al Viro
2011-01-13  5:35 Al Viro
2011-01-13  6:25 ` Stephen Rothwell
2011-01-13  8:55   ` Christoph Hellwig

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=20120108235039.GQ23916@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mszeredi@suse.cz \
    --cc=torvalds@linux-foundation.org \
    --cc=toshi.okajima@jp.fujitsu.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 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).