All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Miao Xie <miaox@cn.fujitsu.com>
Cc: Chris Mason <chris.mason@oracle.com>,
	Linux Btrfs <linux-btrfs@vger.kernel.org>,
	Linux Fsdevel <linux-fsdevel@vger.kernel.org>,
	Ito <t-itoh@jp.fujitsu.com>
Subject: Re: [PATCH 2/2] Btrfs: fix deadlock on sb->s_umount when doing umount
Date: Tue, 6 Dec 2011 05:49:06 +0000	[thread overview]
Message-ID: <20111206054906.GG2203@ZenIV.linux.org.uk> (raw)
In-Reply-To: <4EDDA9B3.60508@cn.fujitsu.com>


> +void btrfs_writeback_inodes_sb_nr(struct btrfs_root *root,
> +				  unsigned long nr_pages)
> +{
> +	struct super_block *sb = root->fs_info->sb;
> +
> +	if (writeback_in_progress(sb->s_bdi))
> +		return;
> +
> +	/*
> +	 * If we can not get s_umount, it means the fs is on remounting or
> +	 * umounting. At this time, we just sync all the delalloc file.
> +	 */
> +	if (down_read_trylock(&sb->s_umount)) {
> +		writeback_inodes_sb_nr(sb, nr_pages);
> +		up_read(&sb->s_umount);
> +	} else {
> +		btrfs_start_delalloc_inodes(root, 0);
> +		btrfs_wait_ordered_extents(root, 0, 0);
> +	}
> +}

If that can race with umount, what prevents sb, its ->s_bdi et.al. being freed
under you?

  reply	other threads:[~2011-12-06  5:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-06  5:35 [PATCH 2/2] Btrfs: fix deadlock on sb->s_umount when doing umount Miao Xie
2011-12-06  5:49 ` Al Viro [this message]
2011-12-06  6:52   ` Miao Xie
2011-12-06  9:59 ` Christoph Hellwig
2011-12-06 11:06   ` Miao Xie
2011-12-06 11:23     ` Christoph Hellwig
2011-12-06 21:36       ` Chris Mason
2011-12-07  2:31         ` Miao Xie
2011-12-07 11:11           ` Ilya Dryomov
2011-12-08  3:46             ` Miao Xie

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=20111206054906.GG2203@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=chris.mason@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miaox@cn.fujitsu.com \
    --cc=t-itoh@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 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.