mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Greg KH <gregkh@linuxfoundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH driver-core-next] sysfs: rename sysfs_assoc_lock and explain what it's about
Date: Thu, 31 Oct 2013 13:11:20 -0400	[thread overview]
Message-ID: <20131031171120.GD11698@mtj.dyndns.org> (raw)
In-Reply-To: <8761se1jfx.fsf@xmission.com>

Hello, Eric.

On Wed, Oct 30, 2013 at 03:29:38PM -0700, Eric W. Biederman wrote:
> Except every time sysfs exports a restriction like that and doesn't
> verify people have held up their end of it someone in the kernel
> inevitably gets the code wrong.  So I don't see how a big fat comment
> buried deep in the underlying abstractions that people use is going to
> make the code easier to understand or maintain.  It certainly won't
> prevent people from goofing up and with no warning.

The big fat comment is not meant for kobject users.  They have always
assumed the responsibility of not issuing conflicting operations
concurrently.  The comment explains the role of the lock so that a
person reading the code can understand what's going on as it is
confusing why the locking is necessary there when the caller is
supposed to be responsible.

Now, it's true that we *can* make kobject interface to allow multiple
concurrent operations and synchronize internally by generalizing the
locking.  Given how kobject is used, I'm not sure what that'd buy tho,
especially for removal.  Because removal puts the base ref as I wrote
before, it's an operation intrinsically reserved to the owner of the
object.  I'm pretty skeptical about its usefulness but if you think
it's worthwhile, please feel free to give it a shot.

Thanks.

-- 
tejun

  reply	other threads:[~2013-10-31 17:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-29 22:09 [PATCH] sysfs: move assignment to be under lock in sysfs_remove_dir() Greg KH
2013-10-30  0:39 ` Eric W. Biederman
2013-10-30  1:25   ` Linus Torvalds
2013-10-30  5:29     ` Eric W. Biederman
2013-10-30 13:28       ` Tejun Heo
2013-10-30 14:28         ` [PATCH driver-core-next] sysfs: rename sysfs_assoc_lock and explain what it's about Tejun Heo
2013-10-30 22:29           ` Eric W. Biederman
2013-10-31 17:11             ` Tejun Heo [this message]
2013-10-30 21:41         ` [PATCH] sysfs: move assignment to be under lock in sysfs_remove_dir() Eric W. Biederman
2013-10-30 22:00           ` Tejun Heo
2013-10-30 22:38           ` Greg KH
2013-10-30 13:14 ` Tejun Heo
2013-10-30 21:42 ` Eric W. Biederman

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=20131031171120.GD11698@mtj.dyndns.org \
    --to=tj@kernel.org \
    --cc=ebiederm@xmission.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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

Powered by JetHome