Commit 9ffbe8ac authored by Nikolay Borisov's avatar Nikolay Borisov Committed by Ingo Molnar
Browse files

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: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarPeter 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: default avatarIngo Molnar <mingo@kernel.org>
parent ba54f0c3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2179,7 +2179,7 @@ static void x86_pmu_event_mapped(struct perf_event *event, struct mm_struct *mm)
	 * For now, this can't happen because all callers hold mmap_sem
	 * for write.  If this changes, we'll need a different solution.
	 */
	lockdep_assert_held_exclusive(&mm->mmap_sem);
	lockdep_assert_held_write(&mm->mmap_sem);

	if (atomic_inc_return(&mm->context.perf_rdpmc_allowed) == 1)
		on_each_cpu_mask(mm_cpumask(mm), refresh_pce, NULL, 1);
+1 −1
Original line number Diff line number Diff line
@@ -457,7 +457,7 @@ static int alloc_name(struct ib_device *ibdev, const char *name)
	int rc;
	int i;

	lockdep_assert_held_exclusive(&devices_rwsem);
	lockdep_assert_held_write(&devices_rwsem);
	ida_init(&inuse);
	xa_for_each (&devices, index, device) {
		char buf[IB_DEVICE_NAME_MAX];
+4 −4
Original line number Diff line number Diff line
@@ -487,7 +487,7 @@ static int tty_ldisc_open(struct tty_struct *tty, struct tty_ldisc *ld)

static void tty_ldisc_close(struct tty_struct *tty, struct tty_ldisc *ld)
{
	lockdep_assert_held_exclusive(&tty->ldisc_sem);
	lockdep_assert_held_write(&tty->ldisc_sem);
	WARN_ON(!test_bit(TTY_LDISC_OPEN, &tty->flags));
	clear_bit(TTY_LDISC_OPEN, &tty->flags);
	if (ld->ops->close)
@@ -509,7 +509,7 @@ static int tty_ldisc_failto(struct tty_struct *tty, int ld)
	struct tty_ldisc *disc = tty_ldisc_get(tty, ld);
	int r;

	lockdep_assert_held_exclusive(&tty->ldisc_sem);
	lockdep_assert_held_write(&tty->ldisc_sem);
	if (IS_ERR(disc))
		return PTR_ERR(disc);
	tty->ldisc = disc;
@@ -633,7 +633,7 @@ EXPORT_SYMBOL_GPL(tty_set_ldisc);
 */
static void tty_ldisc_kill(struct tty_struct *tty)
{
	lockdep_assert_held_exclusive(&tty->ldisc_sem);
	lockdep_assert_held_write(&tty->ldisc_sem);
	if (!tty->ldisc)
		return;
	/*
@@ -681,7 +681,7 @@ int tty_ldisc_reinit(struct tty_struct *tty, int disc)
	struct tty_ldisc *ld;
	int retval;

	lockdep_assert_held_exclusive(&tty->ldisc_sem);
	lockdep_assert_held_write(&tty->ldisc_sem);
	ld = tty_ldisc_get(tty, disc);
	if (IS_ERR(ld)) {
		BUG_ON(disc == N_TTY);
+1 −1
Original line number Diff line number Diff line
@@ -1188,7 +1188,7 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
	unsigned flags = 0;

	if (iov_iter_rw(iter) == WRITE) {
		lockdep_assert_held_exclusive(&inode->i_rwsem);
		lockdep_assert_held_write(&inode->i_rwsem);
		flags |= IOMAP_WRITE;
	} else {
		lockdep_assert_held(&inode->i_rwsem);
+2 −2
Original line number Diff line number Diff line
@@ -394,7 +394,7 @@ extern void lock_unpin_lock(struct lockdep_map *lock, struct pin_cookie);
		WARN_ON(debug_locks && !lockdep_is_held(l));	\
	} while (0)

#define lockdep_assert_held_exclusive(l)	do {			\
#define lockdep_assert_held_write(l)	do {			\
		WARN_ON(debug_locks && !lockdep_is_held_type(l, 0));	\
	} while (0)

@@ -479,7 +479,7 @@ struct lockdep_map { };
#define lockdep_is_held_type(l, r)		(1)

#define lockdep_assert_held(l)			do { (void)(l); } while (0)
#define lockdep_assert_held_exclusive(l)	do { (void)(l); } while (0)
#define lockdep_assert_held_write(l)	do { (void)(l); } while (0)
#define lockdep_assert_held_read(l)		do { (void)(l); } while (0)
#define lockdep_assert_held_once(l)		do { (void)(l); } while (0)

Loading