All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Miklos Szeredi <miklos@szeredi.hu>, jack@suse.cz
Cc: dhowells@redhat.com, viro@ZenIV.linux.org.uk,
	torvalds@linux-foundation.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, hch@infradead.org,
	akpm@linux-foundation.org, apw@canonical.com, nbd@openwrt.org,
	neilb@suse.de, jordipujolp@gmail.com, ezk@fsl.cs.sunysb.edu,
	sedat.dilek@googlemail.com, hooanon05@yahoo.co.jp,
	mszeredi@suse.cz
Subject: Re: [PATCH 2/9] vfs: export do_splice_direct() to modules
Date: Sun, 17 Mar 2013 13:06:59 +0000	[thread overview]
Message-ID: <1944.1363525619@warthog.procyon.org.uk> (raw)
In-Reply-To: <1363184193-1796-3-git-send-email-miklos@szeredi.hu>

Miklos Szeredi <miklos@szeredi.hu> wrote:

> Export do_splice_direct() to modules.  Needed by overlay filesystem.

Apparently you cannot call this from any function that is holding an i_mutex
if the target of the splice uses generic_file_splice_write().

The problem is a potential deadlock situation:

We have places already that do:

	mnt_want_write()
	mutex_lock()

This can be found in do_last() for example.

However, mnt_want_write() calls sb_start_write() as does
generic_file_splice_write().  So now in ovl_copy_up_locked() you're adding:

	mutex_lock()
	sb_start_write()

which lockdep reports as a potential ABBA deadlock.

Now, looking at __sb_start_write(), I'm not entirely sure how the deadlock
might operate, so it's possible that this is a false alarm.  Maybe Jan Kara can
illuminate further, so I've added him to the cc list.

I've attached the report I got with unionmount.

David
---
[ INFO: possible recursive locking detected ]
3.9.0-rc1-fsdevel+ #934 Not tainted
---------------------------------------------
fs-op/4476 is trying to acquire lock:
 (sb_writers#4){.+.+.+}, at: [<ffffffff811087a4>] generic_file_splice_write+0x5d/0x14b
but task is already holding lock:
 (sb_writers#4){.+.+.+}, at: [<ffffffff810ff97c>] mnt_want_write+0x1f/0x46
other info that might help us debug this:
 Possible unsafe locking scenario:
       CPU0
       ----
  lock(sb_writers#4);
  lock(sb_writers#4);
 *** DEADLOCK ***
 May be due to missing lock nesting notation
2 locks held by fs-op/4476:
 #0:  (sb_writers#4){.+.+.+}, at: [<ffffffff810ff97c>] mnt_want_write+0x1f/0x46
 #1:  (&type->i_mutex_dir_key[1]){+.+.+.}, at: [<ffffffff81131c74>] __union_copy_up+0x9a/0x132
stack backtrace:
Pid: 4476, comm: fs-op Not tainted 3.9.0-rc1-fsdevel+ #934
Call Trace:
 [<ffffffff81070398>] __lock_acquire+0x86a/0x16cf
 [<ffffffff811081cc>] ? page_cache_pipe_buf_release+0x1b/0x1b
 [<ffffffff810715e2>] lock_acquire+0x57/0x6d
 [<ffffffff811087a4>] ? generic_file_splice_write+0x5d/0x14b
 [<ffffffff810e3314>] __sb_start_write+0x10d/0x15d
 [<ffffffff811087a4>] ? generic_file_splice_write+0x5d/0x14b
 [<ffffffff811087a4>] generic_file_splice_write+0x5d/0x14b
 [<ffffffff811083d5>] do_splice_from+0x74/0x91
 [<ffffffff81108410>] direct_splice_actor+0x1e/0x20
 [<ffffffff8110868b>] splice_direct_to_actor+0xc2/0x17e
 [<ffffffff811083f2>] ? do_splice_from+0x91/0x91
 [<ffffffff8110999d>] do_splice_direct+0x47/0x5a
 [<ffffffff81131a99>] __union_copy_up_locked+0x171/0x2b2
 [<ffffffff81131cc4>] __union_copy_up+0xea/0x132
 [<ffffffff810e02ca>] vfs_truncate+0x15e/0x289
 [<ffffffff810e043b>] do_sys_truncate+0x46/0x83
 [<ffffffff810e05cf>] sys_truncate+0x9/0xb
 [<ffffffff81456f92>] system_call_fastpath+0x16/0x1b

  parent reply	other threads:[~2013-03-17 13:08 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-13 14:16 [PATCH 0/9] overlay filesystem: request for inclusion (v17) Miklos Szeredi
2013-03-13 14:16 ` [PATCH 1/9] vfs: add i_op->dentry_open() Miklos Szeredi
2013-03-13 22:44   ` Andrew Morton
2013-03-14 11:15     ` Miklos Szeredi
2013-03-13 14:16 ` [PATCH 2/9] vfs: export do_splice_direct() to modules Miklos Szeredi
2013-03-13 22:45   ` Andrew Morton
2013-03-17 13:06   ` David Howells [this message]
2013-03-18  2:31     ` Dave Chinner
2013-03-18 15:39     ` Jan Kara
2013-03-18 21:53       ` Al Viro
2013-03-18 23:01         ` Al Viro
2013-03-19  1:38           ` Al Viro
2013-03-19  9:00             ` J. R. Okajima
2013-03-19 10:29             ` Miklos Szeredi
2013-03-19 11:04               ` David Howells
2013-03-19 11:40                 ` Miklos Szeredi
2013-03-19 17:03               ` Al Viro
2013-03-19 18:32                 ` Miklos Szeredi
2013-03-19 21:24                   ` Al Viro
2013-03-20  9:15                     ` Miklos Szeredi
2013-03-19 20:54           ` Jan Kara
2013-03-19 20:25         ` Jan Kara
2013-03-19 21:38           ` Al Viro
2013-03-19 22:10             ` Al Viro
2013-03-20  2:33               ` Al Viro
2013-03-20 12:30                 ` David Howells
2013-03-20 19:52                 ` Jan Kara
2013-03-20 21:48                   ` Al Viro
2013-03-20 22:19                     ` Jan Kara
2013-03-22 17:37     ` J. R. Okajima
2013-03-22 18:11       ` Al Viro
2013-03-22 18:21         ` Al Viro
2013-03-23  2:49           ` J. R. Okajima
2013-03-23  4:41             ` Al Viro
2013-03-23  5:37               ` J. R. Okajima
2013-03-13 14:16 ` [PATCH 3/9] vfs: export __inode_permission() " Miklos Szeredi
2013-03-13 14:16 ` [PATCH 4/9] vfs: introduce clone_private_mount() Miklos Szeredi
2013-03-13 22:48   ` Andrew Morton
2013-03-14 13:28     ` Miklos Szeredi
2013-03-13 14:16 ` [PATCH 5/9] overlay filesystem Miklos Szeredi
2013-03-13 22:53   ` Andrew Morton
2013-03-13 14:16 ` [PATCH 6/9] overlayfs: add statfs support Miklos Szeredi
2013-03-13 14:16 ` [PATCH 7/9] overlayfs: implement show_options Miklos Szeredi
2013-03-13 14:16 ` [PATCH 8/9] overlay: overlay filesystem documentation Miklos Szeredi
2013-03-13 23:06   ` Andrew Morton
2013-03-14 13:35     ` Miklos Szeredi
2013-03-13 14:16 ` [PATCH 9/9] fs: limit filesystem stacking depth Miklos Szeredi
2013-03-13 14:31 ` [PATCH 0/9] overlay filesystem: request for inclusion (v17) Sedat Dilek
2013-03-13 15:13   ` Sedat Dilek
2013-03-13 15:18     ` Miklos Szeredi
2013-03-13 15:26       ` Sedat Dilek
2013-03-13 15:53         ` Sedat Dilek
2013-03-13 16:10           ` Sedat Dilek
2013-03-13 16:21             ` Miklos Szeredi
2013-03-13 16:35               ` Sedat Dilek
2013-03-13 16:51               ` Sedat Dilek
2013-03-13 18:12                 ` Robin Holt
2013-03-13 18:37                   ` Felix Fietkau
2013-03-13 19:10                     ` Sedat Dilek
2013-03-13 19:54                       ` Eric W. Biederman
2013-03-13 19:58                         ` Linus Torvalds
2013-03-13 20:27                           ` Sedat Dilek
     [not found]             ` <CAB3woddVfZ9PdYPpzidJLBMmUeRx0Rxgb5Pc8bTM9U-tkcS_uA@mail.gmail.com>
2013-03-13 20:32               ` Sedat Dilek
2013-03-13 20:36             ` Phillip Lougher
2013-03-13 23:08 ` Andrew Morton
2013-03-14 13:43   ` Miklos Szeredi
2013-03-15  1:25     ` Al Viro
2013-03-15  4:15       ` J. R. Okajima
2013-03-15  4:44         ` Al Viro
2013-03-15  5:09           ` J. R. Okajima
2013-03-15  5:13             ` Al Viro
2013-03-15  8:15               ` James Bottomley
2013-03-15 12:12                 ` Al Viro
2013-03-15 18:57                   ` J. R. Okajima
2013-03-15 19:26                     ` Erez Zadok
2013-03-15 20:30                     ` Al Viro
2013-03-16 13:55                       ` J. R. Okajima
2013-03-15 19:11             ` Linus Torvalds
2013-03-16 13:57               ` J. R. Okajima

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=1944.1363525619@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=ezk@fsl.cs.sunysb.edu \
    --cc=hch@infradead.org \
    --cc=hooanon05@yahoo.co.jp \
    --cc=jack@suse.cz \
    --cc=jordipujolp@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=mszeredi@suse.cz \
    --cc=nbd@openwrt.org \
    --cc=neilb@suse.de \
    --cc=sedat.dilek@googlemail.com \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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.