Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Fix up over-eager 'wait_queue_t' renaming

Commit ac6424b981bc ("sched/wait: Rename wait_queue_t =>
wait_queue_entry_t") had scripted the renaming incorrectly, and didn't
actually check that the 'wait_queue_t' was a full token.

As a result, it also triggered on 'wait_queue_token', and renamed that
to 'wait_queue_entry_token' entry in the autofs4 packet structure
definition too. That was entirely incorrect, and not intended.

The end result built fine when building just the kernel - because
everything had been renamed consistently there - but caused problems in
user space because the "struct autofs_packet_missing" type is exported
as part of the uapi.

This scripts it all back again:

git grep -lw wait_queue_entry_token |
xargs sed -i 's/wait_queue_entry_token/wait_queue_token/g'

and checks the end result.

Reported-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Fixes: ac6424b981bc ("sched/wait: Rename wait_queue_t => wait_queue_entry_t")
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+20 -20
+6 -6
Documentation/filesystems/autofs4.txt
··· 316 316 struct autofs_v5_packet { 317 317 int proto_version; /* Protocol version */ 318 318 int type; /* Type of packet */ 319 - autofs_wqt_t wait_queue_entry_token; 319 + autofs_wqt_t wait_queue_token; 320 320 __u32 dev; 321 321 __u64 ino; 322 322 __u32 uid; ··· 341 341 `O_DIRECT`) to _pipe2(2)_ so that a read from the pipe will return at 342 342 most one packet, and any unread portion of a packet will be discarded. 343 343 344 - The `wait_queue_entry_token` is a unique number which can identify a 344 + The `wait_queue_token` is a unique number which can identify a 345 345 particular request to be acknowledged. When a message is sent over 346 346 the pipe the affected dentry is marked as either "active" or 347 347 "expiring" and other accesses to it block until the message is 348 348 acknowledged using one of the ioctls below and the relevant 349 - `wait_queue_entry_token`. 349 + `wait_queue_token`. 350 350 351 351 Communicating with autofs: root directory ioctls 352 352 ------------------------------------------------ ··· 358 358 The available ioctl commands are: 359 359 360 360 - **AUTOFS_IOC_READY**: a notification has been handled. The argument 361 - to the ioctl command is the "wait_queue_entry_token" number 361 + to the ioctl command is the "wait_queue_token" number 362 362 corresponding to the notification being acknowledged. 363 363 - **AUTOFS_IOC_FAIL**: similar to above, but indicates failure with 364 364 the error code `ENOENT`. ··· 382 382 struct autofs_packet_expire_multi { 383 383 int proto_version; /* Protocol version */ 384 384 int type; /* Type of packet */ 385 - autofs_wqt_t wait_queue_entry_token; 385 + autofs_wqt_t wait_queue_token; 386 386 int len; 387 387 char name[NAME_MAX+1]; 388 388 }; 389 389 390 390 is required. This is filled in with the name of something 391 391 that can be unmounted or removed. If nothing can be expired, 392 - `errno` is set to `EAGAIN`. Even though a `wait_queue_entry_token` 392 + `errno` is set to `EAGAIN`. Even though a `wait_queue_token` 393 393 is present in the structure, no "wait queue" is established 394 394 and no acknowledgment is needed. 395 395 - **AUTOFS_IOC_EXPIRE_MULTI**: This is similar to
+1 -1
fs/autofs4/autofs_i.h
··· 83 83 struct autofs_wait_queue { 84 84 wait_queue_head_t queue; 85 85 struct autofs_wait_queue *next; 86 - autofs_wqt_t wait_queue_entry_token; 86 + autofs_wqt_t wait_queue_token; 87 87 /* We use the following to see what we are waiting for */ 88 88 struct qstr name; 89 89 u32 dev;
+9 -9
fs/autofs4/waitq.c
··· 104 104 size_t pktsz; 105 105 106 106 pr_debug("wait id = 0x%08lx, name = %.*s, type=%d\n", 107 - (unsigned long) wq->wait_queue_entry_token, 107 + (unsigned long) wq->wait_queue_token, 108 108 wq->name.len, wq->name.name, type); 109 109 110 110 memset(&pkt, 0, sizeof(pkt)); /* For security reasons */ ··· 120 120 121 121 pktsz = sizeof(*mp); 122 122 123 - mp->wait_queue_entry_token = wq->wait_queue_entry_token; 123 + mp->wait_queue_token = wq->wait_queue_token; 124 124 mp->len = wq->name.len; 125 125 memcpy(mp->name, wq->name.name, wq->name.len); 126 126 mp->name[wq->name.len] = '\0'; ··· 133 133 134 134 pktsz = sizeof(*ep); 135 135 136 - ep->wait_queue_entry_token = wq->wait_queue_entry_token; 136 + ep->wait_queue_token = wq->wait_queue_token; 137 137 ep->len = wq->name.len; 138 138 memcpy(ep->name, wq->name.name, wq->name.len); 139 139 ep->name[wq->name.len] = '\0'; ··· 153 153 154 154 pktsz = sizeof(*packet); 155 155 156 - packet->wait_queue_entry_token = wq->wait_queue_entry_token; 156 + packet->wait_queue_token = wq->wait_queue_token; 157 157 packet->len = wq->name.len; 158 158 memcpy(packet->name, wq->name.name, wq->name.len); 159 159 packet->name[wq->name.len] = '\0'; ··· 428 428 return -ENOMEM; 429 429 } 430 430 431 - wq->wait_queue_entry_token = autofs4_next_wait_queue; 431 + wq->wait_queue_token = autofs4_next_wait_queue; 432 432 if (++autofs4_next_wait_queue == 0) 433 433 autofs4_next_wait_queue = 1; 434 434 wq->next = sbi->queues; ··· 461 461 } 462 462 463 463 pr_debug("new wait id = 0x%08lx, name = %.*s, nfy=%d\n", 464 - (unsigned long) wq->wait_queue_entry_token, wq->name.len, 464 + (unsigned long) wq->wait_queue_token, wq->name.len, 465 465 wq->name.name, notify); 466 466 467 467 /* ··· 471 471 } else { 472 472 wq->wait_ctr++; 473 473 pr_debug("existing wait id = 0x%08lx, name = %.*s, nfy=%d\n", 474 - (unsigned long) wq->wait_queue_entry_token, wq->name.len, 474 + (unsigned long) wq->wait_queue_token, wq->name.len, 475 475 wq->name.name, notify); 476 476 mutex_unlock(&sbi->wq_mutex); 477 477 kfree(qstr.name); ··· 550 550 } 551 551 552 552 553 - int autofs4_wait_release(struct autofs_sb_info *sbi, autofs_wqt_t wait_queue_entry_token, int status) 553 + int autofs4_wait_release(struct autofs_sb_info *sbi, autofs_wqt_t wait_queue_token, int status) 554 554 { 555 555 struct autofs_wait_queue *wq, **wql; 556 556 557 557 mutex_lock(&sbi->wq_mutex); 558 558 for (wql = &sbi->queues; (wq = *wql) != NULL; wql = &wq->next) { 559 - if (wq->wait_queue_entry_token == wait_queue_entry_token) 559 + if (wq->wait_queue_token == wait_queue_token) 560 560 break; 561 561 } 562 562
+2 -2
include/uapi/linux/auto_fs.h
··· 26 26 #define AUTOFS_MIN_PROTO_VERSION AUTOFS_PROTO_VERSION 27 27 28 28 /* 29 - * The wait_queue_entry_token (autofs_wqt_t) is part of a structure which is passed 29 + * The wait_queue_token (autofs_wqt_t) is part of a structure which is passed 30 30 * back to the kernel via ioctl from userspace. On architectures where 32- and 31 31 * 64-bit userspace binaries can be executed it's important that the size of 32 32 * autofs_wqt_t stays constant between 32- and 64-bit Linux kernels so that we ··· 49 49 50 50 struct autofs_packet_missing { 51 51 struct autofs_packet_hdr hdr; 52 - autofs_wqt_t wait_queue_entry_token; 52 + autofs_wqt_t wait_queue_token; 53 53 int len; 54 54 char name[NAME_MAX+1]; 55 55 };
+2 -2
include/uapi/linux/auto_fs4.h
··· 108 108 /* v4 multi expire (via pipe) */ 109 109 struct autofs_packet_expire_multi { 110 110 struct autofs_packet_hdr hdr; 111 - autofs_wqt_t wait_queue_entry_token; 111 + autofs_wqt_t wait_queue_token; 112 112 int len; 113 113 char name[NAME_MAX+1]; 114 114 }; ··· 123 123 /* autofs v5 common packet struct */ 124 124 struct autofs_v5_packet { 125 125 struct autofs_packet_hdr hdr; 126 - autofs_wqt_t wait_queue_entry_token; 126 + autofs_wqt_t wait_queue_token; 127 127 __u32 dev; 128 128 __u64 ino; 129 129 __u32 uid;