mirror of
https://github.com/torvalds/linux.git
synced 2024-10-24 14:10:59 +00:00
dentry: Use preempt_[dis|en]able_nested()
Replace the open coded CONFIG_PREEMPT_RT conditional preempt_disable/enable() with the new helper. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Christian Brauner (Microsoft) <brauner@kernel.org> Link: https://lore.kernel.org/r/20220825164131.402717-3-bigeasy@linutronix.de
This commit is contained in:
parent
555bb4ccd1
commit
93f6d4e189
13
fs/dcache.c
13
fs/dcache.c
|
@ -2597,15 +2597,7 @@ EXPORT_SYMBOL(d_rehash);
|
||||||
|
|
||||||
static inline unsigned start_dir_add(struct inode *dir)
|
static inline unsigned start_dir_add(struct inode *dir)
|
||||||
{
|
{
|
||||||
/*
|
preempt_disable_nested();
|
||||||
* The caller holds a spinlock (dentry::d_lock). On !PREEMPT_RT
|
|
||||||
* kernels spin_lock() implicitly disables preemption, but not on
|
|
||||||
* PREEMPT_RT. So for RT it has to be done explicitly to protect
|
|
||||||
* the sequence count write side critical section against a reader
|
|
||||||
* or another writer preempting, which would result in a live lock.
|
|
||||||
*/
|
|
||||||
if (IS_ENABLED(CONFIG_PREEMPT_RT))
|
|
||||||
preempt_disable();
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
unsigned n = dir->i_dir_seq;
|
unsigned n = dir->i_dir_seq;
|
||||||
if (!(n & 1) && cmpxchg(&dir->i_dir_seq, n, n + 1) == n)
|
if (!(n & 1) && cmpxchg(&dir->i_dir_seq, n, n + 1) == n)
|
||||||
|
@ -2618,8 +2610,7 @@ static inline void end_dir_add(struct inode *dir, unsigned int n,
|
||||||
wait_queue_head_t *d_wait)
|
wait_queue_head_t *d_wait)
|
||||||
{
|
{
|
||||||
smp_store_release(&dir->i_dir_seq, n + 2);
|
smp_store_release(&dir->i_dir_seq, n + 2);
|
||||||
if (IS_ENABLED(CONFIG_PREEMPT_RT))
|
preempt_enable_nested();
|
||||||
preempt_enable();
|
|
||||||
wake_up_all(d_wait);
|
wake_up_all(d_wait);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user