All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fernando Luis Vazquez Cao <fernando_b1@lab.ntt.co.jp>
To: Jan Kara <jack@suse.cz>
Cc: "Al Viro" <viro@zeniv.linux.org.uk>,
	"Josef Bacik" <jbacik@fusionio.com>,
	"Eric Sandeen" <sandeen@redhat.com>,
	"Dave Chinner" <dchinner@redhat.com>,
	"Christoph Hellwig" <hch@infradead.org>,
	linux-fsdevel@vger.kernel.org,
	"Fernando Luis Vázquez Cao" <fernando@intellilink.co.jp>
Subject: Re: [PATCH 4/9] fsfreeze: emergency thaw will deadlock on s_umount
Date: Tue, 09 Oct 2012 18:52:27 +0900	[thread overview]
Message-ID: <5073F3DB.8020408@lab.ntt.co.jp> (raw)
In-Reply-To: <20121009082045.GB15790@quack.suse.cz>

On 2012/10/09 17:20, Jan Kara wrote:
> On Tue 09-10-12 14:07:52, Fernando Luis Vazquez Cao wrote:
>>>> diff -urNp linux-3.6.0-rc7-orig/fs/buffer.c linux-3.6.0-rc7/fs/buffer.c
>>>> --- linux-3.6.0-rc7-orig/fs/buffer.c	2012-09-26 13:20:14.842365056 +0900
>>>> +++ linux-3.6.0-rc7/fs/buffer.c	2012-09-26 15:02:22.630595704 +0900
> ...
>>> What I would put here is:
>>> 	if (!res) {
>>> 		deactivate_locked_super(sb);
>>> 		/*
>>> 		 * We have to re-acquire s_umount because
>>> 		 * iterate_supers_write() will unlock it. It still holds
>>> 		 * passive reference so sb cannot be freed under us.
>>> 		 */
>>> 		down_write(&sb->s_umount);
>>> 	}
>>> 	
>>> Is there any problem with this I miss?
>> The reason  I wrote the code as I did is that I did not want to re-acquire
>> s_umount in the normal case (s_active >= 2 entering the if statement).
>>
>> What about combining our approaches and doing something like this?:
>>
>> if (!res && !atomic_add_unless(&sb->s_active, -1, 1)) {
>>       deactivate_locked_super(sb);
>>       down_write(&sb->s_umount);
>> }
>    Well, we are speaking about emergency thaw code. That's no performance
> critical path by any means so I'd trade code simplicity for speed as much
> as possible. atomic_add_unless() makes you think twice what the hell we are
> doing here so I'd avoid it...

I left (and documented) atomic_add_unless() in the new iteration I 
cooked locally,
but I can get rid of it if you feel strongly about it.

I really appreciate you in-depth comments!

Thanks,
Fernando

  reply	other threads:[~2012-10-09  9:52 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-05  5:24 [PATCH 0/9 v5] fsfreeze: miscellaneous fixes and cleanups Fernando Luis Vázquez Cao
2012-10-05  5:31 ` [PATCH 1/9] vfs: add __iterate_supers() and helpers around it Fernando Luis Vázquez Cao
2012-10-08 13:48   ` Jan Kara
2012-10-05  5:33 ` [PATCH 2/9] fsfreeze: add unlocked version of thaw_super Fernando Luis Vázquez Cao
2012-10-05  5:34 ` [PATCH 3/9] fsfreeze: Prevent emergency thaw from looping infinitely Fernando Luis Vázquez Cao
2012-10-05  5:35 ` [PATCH 4/9] fsfreeze: emergency thaw will deadlock on s_umount Fernando Luis Vázquez Cao
2012-10-08 13:57   ` Jan Kara
2012-10-09  5:07     ` Fernando Luis Vazquez Cao
2012-10-09  8:20       ` Jan Kara
2012-10-09  9:52         ` Fernando Luis Vazquez Cao [this message]
2012-10-05  5:38 ` [PATCH 5/9] xfs: switch to using super methods for fsfreeze Fernando Luis Vázquez Cao
2012-10-05  5:39 ` [PATCH 6/9] fsfreeze: move emergency thaw code to fs/super.c Fernando Luis Vázquez Cao
2012-10-05  5:42 ` [PATCH 7/9] fsfreeze: freeze_super and thaw_bdev don't play well together Fernando Luis Vázquez Cao
2012-10-08 14:17   ` Jan Kara
2012-10-05  5:43 ` [PATCH 8/9] fsfreeze: add vfs ioctl to check freeze state Fernando Luis Vázquez Cao
2012-10-08 15:05   ` Jan Kara
2012-10-09  9:46     ` Fernando Luis Vazquez Cao
2012-10-09 14:55       ` Jan Kara
2012-10-10  2:17         ` Fernando Luis Vazquez Cao
2012-10-11 16:26           ` Jan Kara
2012-10-05  5:44 ` [PATCH 9/9] fsfreeze: add block device " Fernando Luis Vázquez Cao
  -- strict thread matches above, loose matches on Subject: below --
2012-09-14  6:43 [RFC, PATCH 0/9 v4] fsfreeze: miscellaneous fixes and cleanups Fernando Luis Vázquez Cao
2012-09-14  6:48 ` [PATCH 4/9] fsfreeze: emergency thaw will deadlock on s_umount Fernando Luis Vázquez Cao
2012-09-25  9:24   ` Jan Kara
2012-09-25 10:31     ` Fernando Luis Vazquez Cao

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=5073F3DB.8020408@lab.ntt.co.jp \
    --to=fernando_b1@lab.ntt.co.jp \
    --cc=dchinner@redhat.com \
    --cc=fernando@intellilink.co.jp \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=jbacik@fusionio.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=sandeen@redhat.com \
    --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.