public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: gregkh@suse.de, dmitry.torokhov@gmail.com, oneukum@suse.de,
	rpurdie@rpsys.net, stern@rowland.harvard.edu, maneesh@in.ibm.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/6] sysfs: use sysfs_lock to protect the sysfs_dirent tree
Date: Wed, 30 May 2007 22:45:47 +0900	[thread overview]
Message-ID: <465D800B.2050502@gmail.com> (raw)
In-Reply-To: <20070530133329.4a10a892@gondolin.boeblingen.de.ibm.com>

Cornelia Huck wrote:
> On Tue, 29 May 2007 01:36:27 +0900,
> Tejun Heo <htejun@gmail.com> wrote:
> 
>> @@ -795,6 +822,8 @@ static int sysfs_readdir(struct file * f
>>  			i++;
>>  			/* fallthrough */
>>  		default:
>> +			spin_lock(&sysfs_lock);
>> +
>>  			pos = &parent_sd->s_children;
>>  			while (*pos != cursor)
>>  				pos = &(*pos)->s_sibling;
>> @@ -827,6 +856,8 @@ static int sysfs_readdir(struct file * f
>>  			/* put cursor back in */
>>  			cursor->s_sibling = *pos;
>>  			*pos = cursor;
>> +
>> +			spin_unlock(&sysfs_lock);
>>  	}
>>  	return 0;
>>  }
> 
> Here's the cause of the "sleeping function called" I saw. filldir() is
> called under sysfs_lock, but calls copy_to_user()... This means you
> can't use sysfs_lock for protection here.

Ouch, right.  I think we can get away with a temp buffer there.  Thanks.

-- 
tejun

  reply	other threads:[~2007-05-30 13:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-28 16:36 [PATCHSET 2.6.22-rc2-mm1 REVIEW] sysfs: make directory dentries/inodes reclaimable Tejun Heo
2007-05-28 16:36 ` [PATCH 1/6] sysfs: implement sysfs flags and SYSFS_FLAG_REMOVED Tejun Heo
2007-05-30 11:54   ` Cornelia Huck
2007-05-30 13:46     ` Tejun Heo
2007-05-28 16:36 ` [PATCH 5/6] sysfs: implement sysfs_get_dentry() Tejun Heo
2007-05-28 16:36 ` [PATCH 3/6] sysfs: make kobj point to sysfs_dirent instead of dentry Tejun Heo
2007-05-28 16:36 ` [PATCH 2/6] sysfs: implement sysfs_find_dirent() and sysfs_get_dirent() Tejun Heo
2007-05-28 16:36 ` [PATCH 4/6] sysfs: use sysfs_lock to protect the sysfs_dirent tree Tejun Heo
2007-05-30 11:33   ` Cornelia Huck
2007-05-30 13:45     ` Tejun Heo [this message]
2007-05-28 16:36 ` [PATCH 6/6] sysfs: make directory dentries and inodes reclaimable Tejun Heo
2007-05-30 10:53 ` [PATCHSET 2.6.22-rc2-mm1 REVIEW] sysfs: make directory dentries/inodes reclaimable Cornelia Huck

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=465D800B.2050502@gmail.com \
    --to=htejun@gmail.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maneesh@in.ibm.com \
    --cc=oneukum@suse.de \
    --cc=rpurdie@rpsys.net \
    --cc=stern@rowland.harvard.edu \
    /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