diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-10 14:40:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-10 14:40:19 -0400 |
commit | 7cee9384cb3e25de33d75ecdbf08bb15b4ea9fa5 (patch) | |
tree | 3c83a2adc99f6d9783219f7e5d76b2ab230e5f53 | |
parent | 9eb788800510ae1a6bc419636a66071ee4deafd5 (diff) |
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>
-rw-r--r-- | Documentation/filesystems/autofs4.txt | 12 | ||||
-rw-r--r-- | fs/autofs4/autofs_i.h | 2 | ||||
-rw-r--r-- | fs/autofs4/waitq.c | 18 | ||||
-rw-r--r-- | include/uapi/linux/auto_fs.h | 4 | ||||
-rw-r--r-- | include/uapi/linux/auto_fs4.h | 4 |
5 files changed, 20 insertions, 20 deletions
diff --git a/Documentation/filesystems/autofs4.txt b/Documentation/filesystems/autofs4.txt index 8444dc3d57e8..f10dd590f69f 100644 --- a/Documentation/filesystems/autofs4.txt +++ b/Documentation/filesystems/autofs4.txt | |||
@@ -316,7 +316,7 @@ For version 5, the format of the message is: | |||
316 | struct autofs_v5_packet { | 316 | struct autofs_v5_packet { |
317 | int proto_version; /* Protocol version */ | 317 | int proto_version; /* Protocol version */ |
318 | int type; /* Type of packet */ | 318 | int type; /* Type of packet */ |
319 | autofs_wqt_t wait_queue_entry_token; | 319 | autofs_wqt_t wait_queue_token; |
320 | __u32 dev; | 320 | __u32 dev; |
321 | __u64 ino; | 321 | __u64 ino; |
322 | __u32 uid; | 322 | __u32 uid; |
@@ -341,12 +341,12 @@ The pipe will be set to "packet mode" (equivalent to passing | |||
341 | `O_DIRECT`) to _pipe2(2)_ so that a read from the pipe will return at | 341 | `O_DIRECT`) to _pipe2(2)_ so that a read from the pipe will return at |
342 | most one packet, and any unread portion of a packet will be discarded. | 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 | particular request to be acknowledged. When a message is sent over | 345 | particular request to be acknowledged. When a message is sent over |
346 | the pipe the affected dentry is marked as either "active" or | 346 | the pipe the affected dentry is marked as either "active" or |
347 | "expiring" and other accesses to it block until the message is | 347 | "expiring" and other accesses to it block until the message is |
348 | acknowledged using one of the ioctls below and the relevant | 348 | acknowledged using one of the ioctls below and the relevant |
349 | `wait_queue_entry_token`. | 349 | `wait_queue_token`. |
350 | 350 | ||
351 | Communicating with autofs: root directory ioctls | 351 | Communicating with autofs: root directory ioctls |
352 | ------------------------------------------------ | 352 | ------------------------------------------------ |
@@ -358,7 +358,7 @@ capability, or must be the automount daemon. | |||
358 | The available ioctl commands are: | 358 | The available ioctl commands are: |
359 | 359 | ||
360 | - **AUTOFS_IOC_READY**: a notification has been handled. The argument | 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 | corresponding to the notification being acknowledged. | 362 | corresponding to the notification being acknowledged. |
363 | - **AUTOFS_IOC_FAIL**: similar to above, but indicates failure with | 363 | - **AUTOFS_IOC_FAIL**: similar to above, but indicates failure with |
364 | the error code `ENOENT`. | 364 | the error code `ENOENT`. |
@@ -382,14 +382,14 @@ The available ioctl commands are: | |||
382 | struct autofs_packet_expire_multi { | 382 | struct autofs_packet_expire_multi { |
383 | int proto_version; /* Protocol version */ | 383 | int proto_version; /* Protocol version */ |
384 | int type; /* Type of packet */ | 384 | int type; /* Type of packet */ |
385 | autofs_wqt_t wait_queue_entry_token; | 385 | autofs_wqt_t wait_queue_token; |
386 | int len; | 386 | int len; |
387 | char name[NAME_MAX+1]; | 387 | char name[NAME_MAX+1]; |
388 | }; | 388 | }; |
389 | 389 | ||
390 | is required. This is filled in with the name of something | 390 | is required. This is filled in with the name of something |
391 | that can be unmounted or removed. If nothing can be expired, | 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 | is present in the structure, no "wait queue" is established | 393 | is present in the structure, no "wait queue" is established |
394 | and no acknowledgment is needed. | 394 | and no acknowledgment is needed. |
395 | - **AUTOFS_IOC_EXPIRE_MULTI**: This is similar to | 395 | - **AUTOFS_IOC_EXPIRE_MULTI**: This is similar to |
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h index 974f5346458a..beef981aa54f 100644 --- a/fs/autofs4/autofs_i.h +++ b/fs/autofs4/autofs_i.h | |||
@@ -83,7 +83,7 @@ struct autofs_info { | |||
83 | struct autofs_wait_queue { | 83 | struct autofs_wait_queue { |
84 | wait_queue_head_t queue; | 84 | wait_queue_head_t queue; |
85 | struct autofs_wait_queue *next; | 85 | struct autofs_wait_queue *next; |
86 | autofs_wqt_t wait_queue_entry_token; | 86 | autofs_wqt_t wait_queue_token; |
87 | /* We use the following to see what we are waiting for */ | 87 | /* We use the following to see what we are waiting for */ |
88 | struct qstr name; | 88 | struct qstr name; |
89 | u32 dev; | 89 | u32 dev; |
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c index 7071895b0678..24a58bf9ca72 100644 --- a/fs/autofs4/waitq.c +++ b/fs/autofs4/waitq.c | |||
@@ -104,7 +104,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, | |||
104 | size_t pktsz; | 104 | size_t pktsz; |
105 | 105 | ||
106 | pr_debug("wait id = 0x%08lx, name = %.*s, type=%d\n", | 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 | wq->name.len, wq->name.name, type); | 108 | wq->name.len, wq->name.name, type); |
109 | 109 | ||
110 | memset(&pkt, 0, sizeof(pkt)); /* For security reasons */ | 110 | memset(&pkt, 0, sizeof(pkt)); /* For security reasons */ |
@@ -120,7 +120,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, | |||
120 | 120 | ||
121 | pktsz = sizeof(*mp); | 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 | mp->len = wq->name.len; | 124 | mp->len = wq->name.len; |
125 | memcpy(mp->name, wq->name.name, wq->name.len); | 125 | memcpy(mp->name, wq->name.name, wq->name.len); |
126 | mp->name[wq->name.len] = '\0'; | 126 | mp->name[wq->name.len] = '\0'; |
@@ -133,7 +133,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, | |||
133 | 133 | ||
134 | pktsz = sizeof(*ep); | 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 | ep->len = wq->name.len; | 137 | ep->len = wq->name.len; |
138 | memcpy(ep->name, wq->name.name, wq->name.len); | 138 | memcpy(ep->name, wq->name.name, wq->name.len); |
139 | ep->name[wq->name.len] = '\0'; | 139 | ep->name[wq->name.len] = '\0'; |
@@ -153,7 +153,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, | |||
153 | 153 | ||
154 | pktsz = sizeof(*packet); | 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 | packet->len = wq->name.len; | 157 | packet->len = wq->name.len; |
158 | memcpy(packet->name, wq->name.name, wq->name.len); | 158 | memcpy(packet->name, wq->name.name, wq->name.len); |
159 | packet->name[wq->name.len] = '\0'; | 159 | packet->name[wq->name.len] = '\0'; |
@@ -428,7 +428,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, | |||
428 | return -ENOMEM; | 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 | if (++autofs4_next_wait_queue == 0) | 432 | if (++autofs4_next_wait_queue == 0) |
433 | autofs4_next_wait_queue = 1; | 433 | autofs4_next_wait_queue = 1; |
434 | wq->next = sbi->queues; | 434 | wq->next = sbi->queues; |
@@ -461,7 +461,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, | |||
461 | } | 461 | } |
462 | 462 | ||
463 | pr_debug("new wait id = 0x%08lx, name = %.*s, nfy=%d\n", | 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 | wq->name.name, notify); | 465 | wq->name.name, notify); |
466 | 466 | ||
467 | /* | 467 | /* |
@@ -471,7 +471,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, | |||
471 | } else { | 471 | } else { |
472 | wq->wait_ctr++; | 472 | wq->wait_ctr++; |
473 | pr_debug("existing wait id = 0x%08lx, name = %.*s, nfy=%d\n", | 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 | wq->name.name, notify); | 475 | wq->name.name, notify); |
476 | mutex_unlock(&sbi->wq_mutex); | 476 | mutex_unlock(&sbi->wq_mutex); |
477 | kfree(qstr.name); | 477 | kfree(qstr.name); |
@@ -550,13 +550,13 @@ int autofs4_wait(struct autofs_sb_info *sbi, | |||
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 | struct autofs_wait_queue *wq, **wql; | 555 | struct autofs_wait_queue *wq, **wql; |
556 | 556 | ||
557 | mutex_lock(&sbi->wq_mutex); | 557 | mutex_lock(&sbi->wq_mutex); |
558 | for (wql = &sbi->queues; (wq = *wql) != NULL; wql = &wq->next) { | 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 | break; | 560 | break; |
561 | } | 561 | } |
562 | 562 | ||
diff --git a/include/uapi/linux/auto_fs.h b/include/uapi/linux/auto_fs.h index 1953f8d6063b..aa63451ef20a 100644 --- a/include/uapi/linux/auto_fs.h +++ b/include/uapi/linux/auto_fs.h | |||
@@ -26,7 +26,7 @@ | |||
26 | #define AUTOFS_MIN_PROTO_VERSION AUTOFS_PROTO_VERSION | 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 | * back to the kernel via ioctl from userspace. On architectures where 32- and | 30 | * back to the kernel via ioctl from userspace. On architectures where 32- and |
31 | * 64-bit userspace binaries can be executed it's important that the size of | 31 | * 64-bit userspace binaries can be executed it's important that the size of |
32 | * autofs_wqt_t stays constant between 32- and 64-bit Linux kernels so that we | 32 | * autofs_wqt_t stays constant between 32- and 64-bit Linux kernels so that we |
@@ -49,7 +49,7 @@ struct autofs_packet_hdr { | |||
49 | 49 | ||
50 | struct autofs_packet_missing { | 50 | struct autofs_packet_missing { |
51 | struct autofs_packet_hdr hdr; | 51 | struct autofs_packet_hdr hdr; |
52 | autofs_wqt_t wait_queue_entry_token; | 52 | autofs_wqt_t wait_queue_token; |
53 | int len; | 53 | int len; |
54 | char name[NAME_MAX+1]; | 54 | char name[NAME_MAX+1]; |
55 | }; | 55 | }; |
diff --git a/include/uapi/linux/auto_fs4.h b/include/uapi/linux/auto_fs4.h index 65b72d0222e7..7c6da423d54e 100644 --- a/include/uapi/linux/auto_fs4.h +++ b/include/uapi/linux/auto_fs4.h | |||
@@ -108,7 +108,7 @@ enum autofs_notify { | |||
108 | /* v4 multi expire (via pipe) */ | 108 | /* v4 multi expire (via pipe) */ |
109 | struct autofs_packet_expire_multi { | 109 | struct autofs_packet_expire_multi { |
110 | struct autofs_packet_hdr hdr; | 110 | struct autofs_packet_hdr hdr; |
111 | autofs_wqt_t wait_queue_entry_token; | 111 | autofs_wqt_t wait_queue_token; |
112 | int len; | 112 | int len; |
113 | char name[NAME_MAX+1]; | 113 | char name[NAME_MAX+1]; |
114 | }; | 114 | }; |
@@ -123,7 +123,7 @@ union autofs_packet_union { | |||
123 | /* autofs v5 common packet struct */ | 123 | /* autofs v5 common packet struct */ |
124 | struct autofs_v5_packet { | 124 | struct autofs_v5_packet { |
125 | struct autofs_packet_hdr hdr; | 125 | struct autofs_packet_hdr hdr; |
126 | autofs_wqt_t wait_queue_entry_token; | 126 | autofs_wqt_t wait_queue_token; |
127 | __u32 dev; | 127 | __u32 dev; |
128 | __u64 ino; | 128 | __u64 ino; |
129 | __u32 uid; | 129 | __u32 uid; |