mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-05 14:40:12 -04:00
Merge tag 'fscache-fixes-20230130' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs
Pull fscache fixes from David Howells:
"Fix two problems in fscache volume handling:
- wake_up_bit() is incorrectly paired with wait_var_event(). The
latter selects the waitqueue to use differently.
- Missing barriers ordering between state bit and task state"
* tag 'fscache-fixes-20230130' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs:
fscache: Use clear_and_wake_up_bit() in fscache_create_volume_work()
fscache: Use wait_on_bit() to wait for the freeing of relinquished volume
This commit is contained in:
@@ -141,13 +141,14 @@ static bool fscache_is_acquire_pending(struct fscache_volume *volume)
|
||||
static void fscache_wait_on_volume_collision(struct fscache_volume *candidate,
|
||||
unsigned int collidee_debug_id)
|
||||
{
|
||||
wait_var_event_timeout(&candidate->flags,
|
||||
!fscache_is_acquire_pending(candidate), 20 * HZ);
|
||||
wait_on_bit_timeout(&candidate->flags, FSCACHE_VOLUME_ACQUIRE_PENDING,
|
||||
TASK_UNINTERRUPTIBLE, 20 * HZ);
|
||||
if (fscache_is_acquire_pending(candidate)) {
|
||||
pr_notice("Potential volume collision new=%08x old=%08x",
|
||||
candidate->debug_id, collidee_debug_id);
|
||||
fscache_stat(&fscache_n_volumes_collision);
|
||||
wait_var_event(&candidate->flags, !fscache_is_acquire_pending(candidate));
|
||||
wait_on_bit(&candidate->flags, FSCACHE_VOLUME_ACQUIRE_PENDING,
|
||||
TASK_UNINTERRUPTIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,8 +280,7 @@ static void fscache_create_volume_work(struct work_struct *work)
|
||||
fscache_end_cache_access(volume->cache,
|
||||
fscache_access_acquire_volume_end);
|
||||
|
||||
clear_bit_unlock(FSCACHE_VOLUME_CREATING, &volume->flags);
|
||||
wake_up_bit(&volume->flags, FSCACHE_VOLUME_CREATING);
|
||||
clear_and_wake_up_bit(FSCACHE_VOLUME_CREATING, &volume->flags);
|
||||
fscache_put_volume(volume, fscache_volume_put_create_work);
|
||||
}
|
||||
|
||||
@@ -347,8 +347,8 @@ static void fscache_wake_pending_volume(struct fscache_volume *volume,
|
||||
hlist_bl_for_each_entry(cursor, p, h, hash_link) {
|
||||
if (fscache_volume_same(cursor, volume)) {
|
||||
fscache_see_volume(cursor, fscache_volume_see_hash_wake);
|
||||
clear_bit(FSCACHE_VOLUME_ACQUIRE_PENDING, &cursor->flags);
|
||||
wake_up_bit(&cursor->flags, FSCACHE_VOLUME_ACQUIRE_PENDING);
|
||||
clear_and_wake_up_bit(FSCACHE_VOLUME_ACQUIRE_PENDING,
|
||||
&cursor->flags);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user