linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Waiman Long <longman@redhat.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	Jens Axboe <axboe@kernel.dk>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@kernel.org>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-block@vger.kernel.org, linux-nilfs@vger.kernel.org,
	cluster-devel@redhat.com,
	Bart Van Assche <Bart.VanAssche@wdc.com>
Subject: Re: [PATCH v6 1/2] blktrace: Fix potentail deadlock between delete & sysfs ops
Date: Tue, 19 Sep 2017 13:41:35 -0700	[thread overview]
Message-ID: <20170919204135.GA7411@infradead.org> (raw)
In-Reply-To: <a4934514-092b-f879-a9e7-ae7a2fd4198c@redhat.com>

On Tue, Sep 19, 2017 at 11:58:34AM -0400, Waiman Long wrote:
> I was trying not to add a new mutex to a structure just for blktrace as
> it is an optional feature that is enabled only if the
> CONFIG_BLK_DEV_IO_TRACE config option is defined and it will only need
> to be taken occasionally.

So?  Make the lock optional, too.

> As filesystem freeze looks orthogonal to blktrace and the mutex also
> looks to be used sparingly, I think it is a good match to overload it to
> control blktrace as well.

If the functionally is orthogonal that is a reason not to share a lock,
not to the contrary.

> I could modify the patch to use a mutex in the request_queue structure.
> The current sysfs_lock mutex has about 74 references. So I am not
> totally sure if it is safe to reuse. So the only option is to add
> something like

> 
> #ifdef CONFIG_BLK_DEV_IO_TRACE
> struct mutex blktrace_mutex;
> #endif
> 
> to the request_queue structure. That structure is large enough that
> adding a mutex won't increase the size much percentage-wise.

Call it blk_trace mutex and move it right next to the blk_trace
structure:

ifdef CONFIG_BLK_DEV_IO_TRACE
        struct blk_trace        *blk_trace;
	struct mutex		blk_trace_mutex;
#endif

which makes it completely obvious to any read what you are protecting
with it.

  reply	other threads:[~2017-09-19 20:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-18 18:53 [PATCH v6 0/2] blktrace: Fix deadlock problem Waiman Long
2017-09-18 18:53 ` [PATCH v6 1/2] blktrace: Fix potentail deadlock between delete & sysfs ops Waiman Long
2017-09-19  0:01   ` Christoph Hellwig
2017-09-19 12:49     ` Waiman Long
2017-09-19 14:38       ` Christoph Hellwig
2017-09-19 15:58         ` Waiman Long
2017-09-19 20:41           ` Christoph Hellwig [this message]
2017-09-19 21:58             ` Steven Rostedt
2017-09-18 18:53 ` [PATCH v6 2/2] block_dev: Rename bd_fsfreeze_mutex Waiman Long
2017-09-18 23:47   ` Christoph Hellwig
2017-09-19 12:43     ` Waiman Long
2017-09-18 21:14 ` [PATCH v6 0/2] blktrace: Fix deadlock problem Steven Rostedt

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=20170919204135.GA7411@infradead.org \
    --to=hch@infradead.org \
    --cc=Bart.VanAssche@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=cluster-devel@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nilfs@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.org \
    /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).