From: Tejun Heo <tj@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: ebiederm@xmission.com, gregkh@suse.de,
linux-kernel@vger.kernel.org, viro@ZenIV.linux.org.uk,
cornelia.huck@de.ibm.com
Subject: Re: [PATCH] sysfs: Reference sysfs_dirent from sysfs inodes.
Date: Wed, 28 Jan 2009 09:47:19 +0900 [thread overview]
Message-ID: <497FAB17.3080607@kernel.org> (raw)
In-Reply-To: <20090127154437.9e7118f7.akpm@linux-foundation.org>
Andrew Morton wrote:
> On Fri, 23 Jan 2009 15:33:48 +0900
> Tejun Heo <tj@kernel.org> wrote:
>
>> Eric W. Biederman wrote:
>>> The sysfs_dirent serves as both an inode and a directory entry
>>> for sysfs. To prevent the sysfs inode numbers from being freed
>>> prematurely hold a reference to sysfs_dirent from the sysfs inode.
>>>
>>> Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
>> Thanks for working on this. Can you please add a comment explaining
>> it on top of sysfs_delete_inode()?
>
> Like this?
>
> --- a/fs/sysfs/inode.c~sysfs-reference-sysfs_dirent-from-sysfs-inodes-fix
> +++ a/fs/sysfs/inode.c
> @@ -215,6 +215,13 @@ struct inode * sysfs_get_inode(struct sy
> return inode;
> }
>
> +/*
> + * The sysfs_dirent serves as both an inode and a directory entry for sysfs.
> + * To prevent the sysfs inode numbers from being freed prematurely we take a
> + * reference to sysfs_dirent from the sysfs inode. A
> + * super_operations.delete_inode() implementation is needed to drop that
> + * reference upon inode destruction.
> + */
> void sysfs_delete_inode(struct inode *inode)
> {
> struct sysfs_dirent *sd = inode->i_private;
Yeap, looks good to me. :-)
Thanks.
--
tejun
next prev parent reply other threads:[~2009-01-28 1:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-21 19:55 [PATCH] sysfs: Take sysfs_mutex when fetching the root inode Eric W. Biederman
2009-01-22 16:49 ` [PATCH] sysfs: Reference sysfs_dirent from sysfs inodes Eric W. Biederman
2009-01-23 6:33 ` Tejun Heo
2009-01-27 23:44 ` Andrew Morton
2009-01-28 0:47 ` Tejun Heo [this message]
2009-02-02 17:03 ` Eric W. Biederman
2009-01-23 6:28 ` [PATCH] sysfs: Take sysfs_mutex when fetching the root inode Tejun Heo
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=497FAB17.3080607@kernel.org \
--to=tj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=cornelia.huck@de.ibm.com \
--cc=ebiederm@xmission.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox