/* RETURNS: Pointer to @sd on success, NULL on failure.  */
static struct sysfs_dirent* sysfs_get_active(struct sysfs_dirent *sd)
/* RETURNS: Pointer to @sd on success, NULL on failure.  */
static struct sysfs_dirent* sysfs_get_active(struct sysfs_dirent *sd)
{
	if (unlikely(!sd))
		return NULL;
	while (1) {
		int v, t;
		v = atomic_read(&sd->s_active);
		if (unlikely(v < 0))
			return NULL;
		t = atomic_cmpxchg(&sd->s_active, v, v + 1);
		if (likely(t == v)) {
			rwsem_acquire_read(&sd->dep_map, 0, 1, _RET_IP_);
			return sd;
		}
		if (t < 0)
			return NULL;
		cpu_relax();
	}
}