Re: [PATCH 3/4] XFS: Return case-insensitive match for dentry cache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Christoph Hellwig wrote:
The cond_resched_lock here is not safe here, because the pointer you
are going to dereference in list_for_each_entry might not be valid
anymore.  This should look more like:

void d_drop_negative_children(struct dentry *parent)
{
	struct dentry *dentry;

 again:
	spin_lock(&dcache_lock);
	list_for_each_entry(dentry, &parent->d_subdirs, d_u.d_child) {
		if !(dentry->d_inode)
			continue;

		spin_lock(&dentry->d_lock);
		__d_drop(dentry);
		spin_unlock(&dentry->d_lock);

		if (need_resched()) {
			spin_unlock(&dcache_lock);
			cond_resched();
			goto again;
		}
	}
	spin_unlock(&dcache_lock);
}
Yes, we have been bitten by the same issue.

Instead of need_resched(), it may be better if you do:

		if (cond_resched_lock(&dcache_lock))
			goto again;


--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux