History

fscache: Fix if condition in fscache_wait_on_volume_collision()

After waiting for the volume to complete the acquisition with timeout, the if condition under which potential volume collision occurs should be acquire the volume is still pending rather than not pending so that we will continue to wait until the pending flag is cleared. Also, use the existing test pending wrapper directly instead of test_bit().

Yue Hu committed 4 years ago

Commit bf174551 parent 03c765b1 file · +2 −2Browse files

Unified · Split

fs/fscache/volume.c+2−2
@@ -143,7 +143,7 @@ static void fscache_wait_on_volume_collision(struct fscache_volume *candidate, · 142 unmodified lines
143143 {
144144 wait_var_event_timeout(&candidate->flags,
145145 !fscache_is_acquire_pending(candidate), 20 * HZ);
146− if (!fscache_is_acquire_pending(candidate)) {
146+ if (fscache_is_acquire_pending(candidate)) {
147147 pr_notice("Potential volume collision new=%08x old=%08x",
148148 candidate->debug_id, collidee_debug_id);
149149 fscache_stat(&fscache_n_volumes_collision);
@@ -182,7 +182,7 @@ static bool fscache_hash_volume(struct fscache_volume *candidate) · 32 unmodified lines
182182 hlist_bl_add_head(&candidate->hash_link, h);
183183 hlist_bl_unlock(h);
184184
185− if (test_bit(FSCACHE_VOLUME_ACQUIRE_PENDING, &candidate->flags))
185+ if (fscache_is_acquire_pending(candidate))
186186 fscache_wait_on_volume_collision(candidate, collidee_debug_id);
187187 return true;
188188