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] [PATCH 1/1] OCFS2: add spin lock when accessing inode->i_nlink.
Date: Mon, 22 Sep 2008 14:18:46 -0700	[thread overview]
Message-ID: <48D80BB6.9080308@oracle.com> (raw)
In-Reply-To: <200809220915.m8M9F1CR004450@wengang.cn.oracle.com>

NAK

Firstly ip_lock does not protect inode. Secondly, the field is
protected by inode_lock. Follow the code:

iput (inode_lock taken) => iput_final ==> ocfs2_drop_inode (inode_lock 
still held).

void iput(struct inode *inode)
{
....
                if (atomic_dec_and_lock(&inode->i_count, &inode_lock))
                        iput_final(inode);
}

static inline void iput_final(struct inode *inode)
{
        struct super_operations *op = inode->i_sb->s_op;
        void (*drop)(struct inode *) = generic_drop_inode;

        if (op && op->drop_inode)
                drop = op->drop_inode;
        drop(inode);
}


wangang wang wrote:
> add spin lock when accessing inode->i_nlink in ocfs2_drop_inode().
>
> the patch is against 1.2 svn.
>
> Signed-off-by: Wengang wang <wen.gang.wang@oracle.com>
> --
> Index: fs/ocfs2/inode.c
> ===================================================================
> --- fs/ocfs2/inode.c	(revision 3101)
> +++ fs/ocfs2/inode.c	(working copy)
> @@ -991,10 +991,12 @@
>  	/* Testing ip_orphaned_slot here wouldn't work because we may
>  	 * not have gotten a delete_inode vote from any other nodes
>  	 * yet. */
> +	spin_lock(&oi->ip_lock);
>  	if (oi->ip_flags & OCFS2_INODE_MAYBE_ORPHANED) {
>  		mlog(0, "Inode was orphaned on another node, clearing nlink.\n");
>  		inode->i_nlink = 0;
>  	}
> +	spin_unlock(&oi->ip_lock);
>  
>  	generic_drop_inode(inode);
>  
>
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel at oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel
>   

  reply	other threads:[~2008-09-22 21:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-22  9:15 [Ocfs2-devel] [PATCH 1/1] OCFS2: add spin lock when accessing inode->i_nlink wangang wang
2008-09-22 21:18 ` Sunil Mushran [this message]
2008-09-23  2:16   ` wengang wang
2008-09-23  3:23     ` Tao Ma
2008-09-23  7:42       ` wengang wang

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=48D80BB6.9080308@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.