All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Waiman Long <longman@redhat.com>
Cc: 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>,
	Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH v7] blktrace: Fix potentail deadlock between delete & sysfs ops
Date: Wed, 20 Sep 2017 10:35:52 -0700	[thread overview]
Message-ID: <20170920173552.GA14611@infradead.org> (raw)
In-Reply-To: <1505928371-27829-1-git-send-email-longman@redhat.com>

> +/*
> + * When reading or writing the blktrace sysfs files, the references to the
> + * opened sysfs or device files should prevent the underlying block device
> + * from being removed. So no further delete protection is really needed.
> + *
> + * Protection from multiple readers and writers accessing blktrace data
> + * concurrently is still required. The bd_mutex was used for this purpose.
> + * That could lead to deadlock with concurrent block device deletion and
> + * sysfs access. As a result, a new blk_trace_mutex is now added to be
> + * used solely by the blktrace code.
> + */

Comments about previous locking schemes really don't have a business
in the code - those are remarks for the commit logs.  And in general
please explain the locking scheme near the data that they proctect
it, as locks should always protected data, not code and the comments
should follow that.

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@infradead.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH v7] blktrace: Fix potentail deadlock between delete & sysfs ops
Date: Wed, 20 Sep 2017 10:35:52 -0700	[thread overview]
Message-ID: <20170920173552.GA14611@infradead.org> (raw)
In-Reply-To: <1505928371-27829-1-git-send-email-longman@redhat.com>

> +/*
> + * When reading or writing the blktrace sysfs files, the references to the
> + * opened sysfs or device files should prevent the underlying block device
> + * from being removed. So no further delete protection is really needed.
> + *
> + * Protection from multiple readers and writers accessing blktrace data
> + * concurrently is still required. The bd_mutex was used for this purpose.
> + * That could lead to deadlock with concurrent block device deletion and
> + * sysfs access. As a result, a new blk_trace_mutex is now added to be
> + * used solely by the blktrace code.
> + */

Comments about previous locking schemes really don't have a business
in the code - those are remarks for the commit logs.  And in general
please explain the locking scheme near the data that they proctect
it, as locks should always protected data, not code and the comments
should follow that.



  parent reply	other threads:[~2017-09-20 17:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-20 17:26 [PATCH v7] blktrace: Fix potentail deadlock between delete & sysfs ops Waiman Long
2017-09-20 17:26 ` Waiman Long
2017-09-20 17:26 ` [Cluster-devel] " Waiman Long
2017-09-20 17:32 ` Steven Rostedt
2017-09-20 17:32   ` [Cluster-devel] " Steven Rostedt
2017-09-20 19:09   ` Jens Axboe
2017-09-20 19:09     ` [Cluster-devel] " Jens Axboe
2017-09-20 19:27     ` Steven Rostedt
2017-09-20 19:27       ` [Cluster-devel] " Steven Rostedt
2017-09-20 17:35 ` Christoph Hellwig [this message]
2017-09-20 17:35   ` Christoph Hellwig
2017-09-20 19:05   ` Waiman Long
2017-09-20 19:05     ` Waiman Long
2017-09-20 19:05     ` [Cluster-devel] " Waiman Long
2017-09-20 19:05     ` Waiman Long

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=20170920173552.GA14611@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 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.