<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<tt>On 04/19/2011 05:20 PM, Sunil Mushran wrote:</tt>
<blockquote cite="mid:4DAE26BA.3010203@oracle.com" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<tt> On 04/19/2011 12:48 PM, Joel Becker wrote:<br>
</tt>
<blockquote cite="mid:20110419194840.GA27826@noexit" type="cite">
<pre wrap=""><tt>        You're too late here. This is in the echo process (bash,
really). getdents() isn't happening.
        The problem is almost certainly in configfs. It's a race
between setup and teardown of the virtual attribute files. If anyone
else has a cycle to look at it, great, otherwise I'll try to get to it
later this week.
</tt></pre>
</blockquote>
<tt><br>
<span id="mainframespan"> So we ran into it internally. This is
what I wrote in the bug.<br>
<br>
<i>@ The matching code in configfs_readir() is:</i> <br>
<i>@ name = configfs_get_name(next);</i> <br>
<i>@ len = strlen(name);</i> <br>
<i>@ if (next->s_dentry)</i> <br>
<i>@ ino =
next->s_dentry->d_inode->i_ino; <===</i> <br>
<i>@ else</i> <br>
<i>@ ino = iunique(configfs_sb, 2);</i> <br>
<i>@ .</i> <br>
<i>@ if (filldir(dirent, name, len, filp->f_pos, ino,</i>
<br>
<i>@ dt_type(next)) < 0)</i> <br>
<i>@ return 0;</i> <br>
<i>@ .</i> <br>
<i>@ The oops indicates that next->s_dentry->d_inode is
NULL.</i></span><br>
<br>
</tt><tt><span id="mainframespan">Joel, does this give you any
clues?<br>
</span><br>
</tt> <tt>BTW, thanks for the testcase. And yes, I can reproduce
it easily.<br>
</tt></blockquote>
<tt><br>
configfs_readdir() is racing configfs_d_delete(). And I cannot<br>
see how we can use the existing spinlock to prevent the race.<br>
<br>
sysfs uses a coarse lock sysfs_mutex to prevent against this.<br>
I think we should do the same in configfs.<br>
<br>
Comments?<br>
<br>
=============================================<br>
commit 3007e997de91ec59af39a3f9c91595b31ae6e08b<br>
Author: Tejun Heo <a class="moz-txt-link-rfc2396E" href="mailto:htejun@gmail.com"><htejun@gmail.com></a><br>
Date: Thu Jun 14 04:27:23 2007 +0900<br>
<br>
sysfs: use sysfs_mutex to protect the sysfs_dirent tree<br>
<br>
As kobj sysfs dentries and inodes are gonna be made
reclaimable,<br>
i_mutex can't be used to protect sysfs_dirent tree. Use
sysfs_mutex<br>
globally instead. As the whole tree is protected with
sysfs_mutex,<br>
there is no reason to keep sysfs_rename_sem. Drop it.<br>
<br>
While at it, add docbook comments to functions which require<br>
sysfs_mutex locking.<br>
<br>
Signed-off-by: Tejun Heo <a class="moz-txt-link-rfc2396E" href="mailto:htejun@gmail.com"><htejun@gmail.com></a><br>
Signed-off-by: Greg Kroah-Hartman <a class="moz-txt-link-rfc2396E" href="mailto:gregkh@suse.de"><gregkh@suse.de></a><br>
</tt><tt>=============================================</tt><br>
</body>
</html>