All of lore.kernel.org
 help / color / mirror / Atom feed
From: wengang wang <wen.gang.wang@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 1/1] OCFS2: unhash all dentries on a inode.
Date: Tue, 23 Sep 2008 13:27:26 +0800	[thread overview]
Message-ID: <48D87E3E.10105@oracle.com> (raw)
In-Reply-To: <48D874CC.1020402@oracle.com>

Sunil Mushran wrote:
> If so, won't that be a bug?
>
If you meant my patch is bug, why?
unhashing dentry from dentry cache only leads to a mis-match in that 
cache when a new request comes.
when the dentry is not found in cache, before creating a new dentry, a 
validation check should be done on the inode in inode cache or by 
ocfs2_lookup().
so I think there is no problem.

without unhashing the dentries, dput() won't call dentry_iput(). thus 
the stale inode will be kept in memory for ever. --this is a problem.

thanks,
wengang.
> wengang wang wrote:
>> Sunil,
>>
>> d_prune_aliases() unhashes dentries that has 0 reference count, 
>> dentries with non-zero ref count won't be unhashed.
>> My code unhashes all no matter there reference counts are 0 or not.
>>
>> regards,
>> wengang.
>>
>> Sunil Mushran wrote:
>>> NAK.
>>>
>>> I fail to understand your logic. The code you've added is pretty
>>> much what d_prune_aliases() does (the call you have deleted).
>>>
>>> wangang wang wrote:
>>>> In ocfs2_process_delete_request(), we should unhash all dentries on 
>>>> the inode.
>>>> --not only the ones with 0 referrence count. so that it's possible 
>>>> for dput()
>>>> to drop the stale inode.
>>>>
>>>> the patch is against 1.2 svn.
>>>>
>>>> Signed-off-by: Wengang wang <wen.gang.wang@oracle.com>
>>>> -- 
>>>>
>>>> Index: fs/ocfs2/vote.c
>>>> ===================================================================
>>>> --- fs/ocfs2/vote.c    (revision 3101)
>>>> +++ fs/ocfs2/vote.c    (working copy)
>>>> @@ -176,6 +176,7 @@
>>>>                      int deleting_node)
>>>>  {
>>>>      int response = OCFS2_RESPONSE_BUSY;
>>>> +    struct list_head *tmp, *head;
>>>>  
>>>>      mlog(0, "DELETE vote on inode %lu, read lnk_cnt = %u, slot = 
>>>> %d\n",
>>>>           inode->i_ino, inode->i_nlink, *orphaned_slot);
>>>> @@ -253,9 +254,19 @@
>>>>      ocfs2_mark_inode_remotely_deleted(inode, deleting_node);
>>>>      spin_unlock(&OCFS2_I(inode)->ip_lock);
>>>>  
>>>> -    /* Not sure this is necessary anymore. */
>>>> -    d_prune_aliases(inode);
>>>> +    /* unhash all dentries on this inode */
>>>> +    spin_lock(&dcache_lock);
>>>> +    head = &inode->i_dentry;
>>>> +    tmp = head;
>>>>  
>>>> +    while ((tmp = tmp->next) != head) {
>>>> +        struct dentry *dentry = list_entry(tmp, struct dentry, 
>>>> d_alias);
>>>> +        spin_lock(&dentry->d_lock);
>>>> +        __d_drop(dentry);
>>>> +        spin_unlock(&dentry->d_lock);
>>>> +    }
>>>> +    spin_unlock(&dcache_lock);
>>>> +
>>>>      /* If we get here, then we're voting 'yes', so commit the
>>>>       * delete on our side. */
>>>>      response = OCFS2_RESPONSE_OK;
>>>>
>>>> _______________________________________________
>>>> Ocfs2-devel mailing list
>>>> Ocfs2-devel at oss.oracle.com
>>>> http://oss.oracle.com/mailman/listinfo/ocfs2-devel
>>>>   
>>>
>>
>

-- 
Wengang Wang
Member of Technical Staff
Oracle Asia R&D Center
Open Source Technologies Development

Tel:      +86 10 8278 6265
Mobile:   +86 13381078925

      reply	other threads:[~2008-09-23  5:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-22  9:48 [Ocfs2-devel] [PATCH 1/1] OCFS2: unhash all dentries on a inode wangang wang
2008-09-22 21:46 ` Sunil Mushran
2008-09-23  1:51   ` wengang wang
2008-09-23  4:47     ` Sunil Mushran
2008-09-23  5:27       ` wengang wang [this message]

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=48D87E3E.10105@oracle.com \
    --to=wen.gang.wang@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.