aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/sysfs/dir.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 2fbdff6be25c..7f968ede20d6 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -165,21 +165,8 @@ struct sysfs_dirent *sysfs_get_active(struct sysfs_dirent *sd)
165 if (unlikely(!sd)) 165 if (unlikely(!sd))
166 return NULL; 166 return NULL;
167 167
168 while (1) { 168 if (!atomic_inc_unless_negative(&sd->s_active))
169 int v, t; 169 return NULL;
170
171 v = atomic_read(&sd->s_active);
172 if (unlikely(v < 0))
173 return NULL;
174
175 t = atomic_cmpxchg(&sd->s_active, v, v + 1);
176 if (likely(t == v))
177 break;
178 if (t < 0)
179 return NULL;
180
181 cpu_relax();
182 }
183 170
184 if (likely(!ignore_lockdep(sd))) 171 if (likely(!ignore_lockdep(sd)))
185 rwsem_acquire_read(&sd->dep_map, 0, 1, _RET_IP_); 172 rwsem_acquire_read(&sd->dep_map, 0, 1, _RET_IP_);