All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sunil Mushran <sunil.mushran@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [Ocfs2-users] ocfs or configfs bug ?
Date: Tue, 10 May 2011 18:38:17 -0700	[thread overview]
Message-ID: <4DC9E889.3080008@oracle.com> (raw)
In-Reply-To: <4DAE26BA.3010203@oracle.com>

On 04/19/2011 05:20 PM, Sunil Mushran wrote:
> On 04/19/2011 12:48 PM, Joel Becker wrote:
>> 	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.
>
> So we ran into it internally. This is what I wrote in the bug.
>
> /@ The matching code in configfs_readir() is:/
> /@     name = configfs_get_name(next);/
> /@     len = strlen(name);/
> /@     if (next->s_dentry)/
> /@            ino = next->s_dentry->d_inode->i_ino; <===/
> /@     else/
> /@            ino = iunique(configfs_sb, 2);/
> /@ ./
> /@     if (filldir(dirent, name, len, filp->f_pos, ino,/
> /@                 dt_type(next)) < 0)/
> /@            return 0;/
> /@ ./
> /@ The oops indicates that next->s_dentry->d_inode is NULL./
>
> Joel, does this give you any clues?
>
> BTW, thanks for the testcase. And yes, I can reproduce it easily.

configfs_readdir() is racing configfs_d_delete(). And I cannot
see how we can use the existing spinlock to prevent the race.

sysfs uses a coarse lock sysfs_mutex to prevent against this.
I think we should do the same in configfs.

Comments?

=============================================
commit 3007e997de91ec59af39a3f9c91595b31ae6e08b
Author: Tejun Heo <htejun@gmail.com>
Date:   Thu Jun 14 04:27:23 2007 +0900

     sysfs: use sysfs_mutex to protect the sysfs_dirent tree

     As kobj sysfs dentries and inodes are gonna be made reclaimable,
     i_mutex can't be used to protect sysfs_dirent tree.  Use sysfs_mutex
     globally instead.  As the whole tree is protected with sysfs_mutex,
     there is no reason to keep sysfs_rename_sem.  Drop it.

     While at it, add docbook comments to functions which require
     sysfs_mutex locking.

     Signed-off-by: Tejun Heo <htejun@gmail.com>
     Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
=============================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://oss.oracle.com/pipermail/ocfs2-devel/attachments/20110510/4219fe9b/attachment.html 

  reply	other threads:[~2011-05-11  1:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4DADA228.5050209@bull.net>
     [not found] ` <20110419194840.GA27826@noexit>
2011-04-20  0:20   ` [Ocfs2-devel] [Ocfs2-users] ocfs or configfs bug ? Sunil Mushran
2011-05-11  1:38     ` Sunil Mushran [this message]
2011-05-18 10:49       ` Joel Becker
2011-05-18 11:12         ` Joel Becker
2011-05-18 18:36           ` Sunil Mushran
2011-05-18 19:11             ` Joel Becker
2011-05-18 20:08               ` Sunil Mushran

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=4DC9E889.3080008@oracle.com \
    --to=sunil.mushran@oracle.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /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.