diff options
author | Nikolay Borisov <nborisov@suse.com> | 2019-05-31 06:06:51 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2019-06-17 06:09:24 -0400 |
commit | 9ffbe8ac05dbb4ab4a4836a55a47fc6be945a38f (patch) | |
tree | b75a7823242b8595bec5059167168719643ac3b0 | |
parent | ba54f0c3f7c400a392c413d8ca21d3ada35f2584 (diff) |
locking/lockdep: Rename lockdep_assert_held_exclusive() -> lockdep_assert_held_write()
All callers of lockdep_assert_held_exclusive() use it to verify the
correct locking state of either a semaphore (ldisc_sem in tty,
mmap_sem for perf events, i_rwsem of inode for dax) or rwlock by
apparmor. Thus it makes sense to rename _exclusive to _write since
that's the semantics callers care. Additionally there is already
lockdep_assert_held_read(), which this new naming is more consistent with.
No functional changes.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20190531100651.3969-1-nborisov@suse.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/events/core.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/core/device.c | 2 | ||||
-rw-r--r-- | drivers/tty/tty_ldisc.c | 8 | ||||
-rw-r--r-- | fs/dax.c | 2 | ||||
-rw-r--r-- | include/linux/lockdep.h | 4 | ||||
-rw-r--r-- | security/apparmor/label.c | 8 |
6 files changed, 13 insertions, 13 deletions
diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index f315425d8468..cf91d80b8452 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c | |||
@@ -2179,7 +2179,7 @@ static void x86_pmu_event_mapped(struct perf_event *event, struct mm_struct *mm) | |||
2179 | * For now, this can't happen because all callers hold mmap_sem | 2179 | * For now, this can't happen because all callers hold mmap_sem |
2180 | * for write. If this changes, we'll need a different solution. | 2180 | * for write. If this changes, we'll need a different solution. |
2181 | */ | 2181 | */ |
2182 | lockdep_assert_held_exclusive(&mm->mmap_sem); | 2182 | lockdep_assert_held_write(&mm->mmap_sem); |
2183 | 2183 | ||
2184 | if (atomic_inc_return(&mm->context.perf_rdpmc_allowed) == 1) | 2184 | if (atomic_inc_return(&mm->context.perf_rdpmc_allowed) == 1) |
2185 | on_each_cpu_mask(mm_cpumask(mm), refresh_pce, NULL, 1); | 2185 | on_each_cpu_mask(mm_cpumask(mm), refresh_pce, NULL, 1); |
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 29f7b15c81d9..d020bb4d03d5 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c | |||
@@ -457,7 +457,7 @@ static int alloc_name(struct ib_device *ibdev, const char *name) | |||
457 | int rc; | 457 | int rc; |
458 | int i; | 458 | int i; |
459 | 459 | ||
460 | lockdep_assert_held_exclusive(&devices_rwsem); | 460 | lockdep_assert_held_write(&devices_rwsem); |
461 | ida_init(&inuse); | 461 | ida_init(&inuse); |
462 | xa_for_each (&devices, index, device) { | 462 | xa_for_each (&devices, index, device) { |
463 | char buf[IB_DEVICE_NAME_MAX]; | 463 | char buf[IB_DEVICE_NAME_MAX]; |
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c index e38f104db174..fde8d4073e74 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c | |||
@@ -487,7 +487,7 @@ static int tty_ldisc_open(struct tty_struct *tty, struct tty_ldisc *ld) | |||
487 | 487 | ||
488 | static void tty_ldisc_close(struct tty_struct *tty, struct tty_ldisc *ld) | 488 | static void tty_ldisc_close(struct tty_struct *tty, struct tty_ldisc *ld) |
489 | { | 489 | { |
490 | lockdep_assert_held_exclusive(&tty->ldisc_sem); | 490 | lockdep_assert_held_write(&tty->ldisc_sem); |
491 | WARN_ON(!test_bit(TTY_LDISC_OPEN, &tty->flags)); | 491 | WARN_ON(!test_bit(TTY_LDISC_OPEN, &tty->flags)); |
492 | clear_bit(TTY_LDISC_OPEN, &tty->flags); | 492 | clear_bit(TTY_LDISC_OPEN, &tty->flags); |
493 | if (ld->ops->close) | 493 | if (ld->ops->close) |
@@ -509,7 +509,7 @@ static int tty_ldisc_failto(struct tty_struct *tty, int ld) | |||
509 | struct tty_ldisc *disc = tty_ldisc_get(tty, ld); | 509 | struct tty_ldisc *disc = tty_ldisc_get(tty, ld); |
510 | int r; | 510 | int r; |
511 | 511 | ||
512 | lockdep_assert_held_exclusive(&tty->ldisc_sem); | 512 | lockdep_assert_held_write(&tty->ldisc_sem); |
513 | if (IS_ERR(disc)) | 513 | if (IS_ERR(disc)) |
514 | return PTR_ERR(disc); | 514 | return PTR_ERR(disc); |
515 | tty->ldisc = disc; | 515 | tty->ldisc = disc; |
@@ -633,7 +633,7 @@ EXPORT_SYMBOL_GPL(tty_set_ldisc); | |||
633 | */ | 633 | */ |
634 | static void tty_ldisc_kill(struct tty_struct *tty) | 634 | static void tty_ldisc_kill(struct tty_struct *tty) |
635 | { | 635 | { |
636 | lockdep_assert_held_exclusive(&tty->ldisc_sem); | 636 | lockdep_assert_held_write(&tty->ldisc_sem); |
637 | if (!tty->ldisc) | 637 | if (!tty->ldisc) |
638 | return; | 638 | return; |
639 | /* | 639 | /* |
@@ -681,7 +681,7 @@ int tty_ldisc_reinit(struct tty_struct *tty, int disc) | |||
681 | struct tty_ldisc *ld; | 681 | struct tty_ldisc *ld; |
682 | int retval; | 682 | int retval; |
683 | 683 | ||
684 | lockdep_assert_held_exclusive(&tty->ldisc_sem); | 684 | lockdep_assert_held_write(&tty->ldisc_sem); |
685 | ld = tty_ldisc_get(tty, disc); | 685 | ld = tty_ldisc_get(tty, disc); |
686 | if (IS_ERR(ld)) { | 686 | if (IS_ERR(ld)) { |
687 | BUG_ON(disc == N_TTY); | 687 | BUG_ON(disc == N_TTY); |
@@ -1188,7 +1188,7 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter, | |||
1188 | unsigned flags = 0; | 1188 | unsigned flags = 0; |
1189 | 1189 | ||
1190 | if (iov_iter_rw(iter) == WRITE) { | 1190 | if (iov_iter_rw(iter) == WRITE) { |
1191 | lockdep_assert_held_exclusive(&inode->i_rwsem); | 1191 | lockdep_assert_held_write(&inode->i_rwsem); |
1192 | flags |= IOMAP_WRITE; | 1192 | flags |= IOMAP_WRITE; |
1193 | } else { | 1193 | } else { |
1194 | lockdep_assert_held(&inode->i_rwsem); | 1194 | lockdep_assert_held(&inode->i_rwsem); |
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 30a0f81aa130..151d55711082 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h | |||
@@ -394,7 +394,7 @@ extern void lock_unpin_lock(struct lockdep_map *lock, struct pin_cookie); | |||
394 | WARN_ON(debug_locks && !lockdep_is_held(l)); \ | 394 | WARN_ON(debug_locks && !lockdep_is_held(l)); \ |
395 | } while (0) | 395 | } while (0) |
396 | 396 | ||
397 | #define lockdep_assert_held_exclusive(l) do { \ | 397 | #define lockdep_assert_held_write(l) do { \ |
398 | WARN_ON(debug_locks && !lockdep_is_held_type(l, 0)); \ | 398 | WARN_ON(debug_locks && !lockdep_is_held_type(l, 0)); \ |
399 | } while (0) | 399 | } while (0) |
400 | 400 | ||
@@ -479,7 +479,7 @@ struct lockdep_map { }; | |||
479 | #define lockdep_is_held_type(l, r) (1) | 479 | #define lockdep_is_held_type(l, r) (1) |
480 | 480 | ||
481 | #define lockdep_assert_held(l) do { (void)(l); } while (0) | 481 | #define lockdep_assert_held(l) do { (void)(l); } while (0) |
482 | #define lockdep_assert_held_exclusive(l) do { (void)(l); } while (0) | 482 | #define lockdep_assert_held_write(l) do { (void)(l); } while (0) |
483 | #define lockdep_assert_held_read(l) do { (void)(l); } while (0) | 483 | #define lockdep_assert_held_read(l) do { (void)(l); } while (0) |
484 | #define lockdep_assert_held_once(l) do { (void)(l); } while (0) | 484 | #define lockdep_assert_held_once(l) do { (void)(l); } while (0) |
485 | 485 | ||
diff --git a/security/apparmor/label.c b/security/apparmor/label.c index 068e93c5d29c..59f1cc2557a7 100644 --- a/security/apparmor/label.c +++ b/security/apparmor/label.c | |||
@@ -76,7 +76,7 @@ void __aa_proxy_redirect(struct aa_label *orig, struct aa_label *new) | |||
76 | 76 | ||
77 | AA_BUG(!orig); | 77 | AA_BUG(!orig); |
78 | AA_BUG(!new); | 78 | AA_BUG(!new); |
79 | lockdep_assert_held_exclusive(&labels_set(orig)->lock); | 79 | lockdep_assert_held_write(&labels_set(orig)->lock); |
80 | 80 | ||
81 | tmp = rcu_dereference_protected(orig->proxy->label, | 81 | tmp = rcu_dereference_protected(orig->proxy->label, |
82 | &labels_ns(orig)->lock); | 82 | &labels_ns(orig)->lock); |
@@ -566,7 +566,7 @@ static bool __label_remove(struct aa_label *label, struct aa_label *new) | |||
566 | 566 | ||
567 | AA_BUG(!ls); | 567 | AA_BUG(!ls); |
568 | AA_BUG(!label); | 568 | AA_BUG(!label); |
569 | lockdep_assert_held_exclusive(&ls->lock); | 569 | lockdep_assert_held_write(&ls->lock); |
570 | 570 | ||
571 | if (new) | 571 | if (new) |
572 | __aa_proxy_redirect(label, new); | 572 | __aa_proxy_redirect(label, new); |
@@ -603,7 +603,7 @@ static bool __label_replace(struct aa_label *old, struct aa_label *new) | |||
603 | AA_BUG(!ls); | 603 | AA_BUG(!ls); |
604 | AA_BUG(!old); | 604 | AA_BUG(!old); |
605 | AA_BUG(!new); | 605 | AA_BUG(!new); |
606 | lockdep_assert_held_exclusive(&ls->lock); | 606 | lockdep_assert_held_write(&ls->lock); |
607 | AA_BUG(new->flags & FLAG_IN_TREE); | 607 | AA_BUG(new->flags & FLAG_IN_TREE); |
608 | 608 | ||
609 | if (!label_is_stale(old)) | 609 | if (!label_is_stale(old)) |
@@ -640,7 +640,7 @@ static struct aa_label *__label_insert(struct aa_labelset *ls, | |||
640 | AA_BUG(!ls); | 640 | AA_BUG(!ls); |
641 | AA_BUG(!label); | 641 | AA_BUG(!label); |
642 | AA_BUG(labels_set(label) != ls); | 642 | AA_BUG(labels_set(label) != ls); |
643 | lockdep_assert_held_exclusive(&ls->lock); | 643 | lockdep_assert_held_write(&ls->lock); |
644 | AA_BUG(label->flags & FLAG_IN_TREE); | 644 | AA_BUG(label->flags & FLAG_IN_TREE); |
645 | 645 | ||
646 | /* Figure out where to put new node */ | 646 | /* Figure out where to put new node */ |