Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1735253

Re: [PATCH v6 1/2] blktrace: Fix potentail deadlock between delete & sysfs ops

From Christoph Hellwig <hch@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH v6 1/2] blktrace: Fix potentail deadlock between delete & sysfs ops
Date 2017-09-19 22:50 +0200
Message-ID <urxCW-1Jf-15@gated-at.bofh.it> (permalink)
References (1 earlier) <ur9qV-1Et-13@gated-at.bofh.it> <uregV-5fg-1@gated-at.bofh.it> <urq8q-5xV-19@gated-at.bofh.it> <urrQS-6Dj-17@gated-at.bofh.it> <urt6i-7kk-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v6 1/2] blktrace: Fix potentail deadlock between delete & sysfs ops Waiman Long <longman@redhat.com> - 2017-09-18 21:00 +0200
  Re: [PATCH v6 1/2] blktrace: Fix potentail deadlock between delete &  sysfs ops Christoph Hellwig <hch@infradead.org> - 2017-09-19 02:10 +0200
    Re: [PATCH v6 1/2] blktrace: Fix potentail deadlock between delete &  sysfs ops Waiman Long <longman@redhat.com> - 2017-09-19 14:50 +0200
      Re: [PATCH v6 1/2] blktrace: Fix potentail deadlock between delete &  sysfs ops Christoph Hellwig <hch@infradead.org> - 2017-09-19 16:40 +0200
        Re: [PATCH v6 1/2] blktrace: Fix potentail deadlock between delete &  sysfs ops Waiman Long <longman@redhat.com> - 2017-09-19 18:00 +0200
          Re: [PATCH v6 1/2] blktrace: Fix potentail deadlock between delete &  sysfs ops Christoph Hellwig <hch@infradead.org> - 2017-09-19 22:50 +0200
            Re: [PATCH v6 1/2] blktrace: Fix potentail deadlock between delete  & sysfs ops Steven Rostedt <rostedt@goodmis.org> - 2017-09-20 00:00 +0200

csiph-web