Commit 7cee9384 authored by Linus Torvalds's avatar Linus Torvalds

Fix up over-eager 'wait_queue_t' renaming

Commit ac6424b9 ("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: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Acked-by: default avatarIngo Molnar <mingo@kernel.org>
Fixes: ac6424b9 ("sched/wait: Rename wait_queue_t => wait_queue_entry_t")
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 9eb78880
...@@ -316,7 +316,7 @@ For version 5, the format of the message is: ...@@ -316,7 +316,7 @@ For version 5, the format of the message is:
struct autofs_v5_packet { struct autofs_v5_packet {
int proto_version; /* Protocol version */ int proto_version; /* Protocol version */
int type; /* Type of packet */ int type; /* Type of packet */
autofs_wqt_t wait_queue_entry_token; autofs_wqt_t wait_queue_token;
__u32 dev; __u32 dev;
__u64 ino; __u64 ino;
__u32 uid; __u32 uid;
...@@ -341,12 +341,12 @@ The pipe will be set to "packet mode" (equivalent to passing ...@@ -341,12 +341,12 @@ The pipe will be set to "packet mode" (equivalent to passing
`O_DIRECT`) to _pipe2(2)_ so that a read from the pipe will return at `O_DIRECT`) to _pipe2(2)_ so that a read from the pipe will return at
most one packet, and any unread portion of a packet will be discarded. most one packet, and any unread portion of a packet will be discarded.
The `wait_queue_entry_token` is a unique number which can identify a The `wait_queue_token` is a unique number which can identify a
particular request to be acknowledged. When a message is sent over particular request to be acknowledged. When a message is sent over
the pipe the affected dentry is marked as either "active" or the pipe the affected dentry is marked as either "active" or
"expiring" and other accesses to it block until the message is "expiring" and other accesses to it block until the message is
acknowledged using one of the ioctls below and the relevant acknowledged using one of the ioctls below and the relevant
`wait_queue_entry_token`. `wait_queue_token`.
Communicating with autofs: root directory ioctls Communicating with autofs: root directory ioctls
------------------------------------------------ ------------------------------------------------
...@@ -358,7 +358,7 @@ capability, or must be the automount daemon. ...@@ -358,7 +358,7 @@ capability, or must be the automount daemon.
The available ioctl commands are: The available ioctl commands are:
- **AUTOFS_IOC_READY**: a notification has been handled. The argument - **AUTOFS_IOC_READY**: a notification has been handled. The argument
to the ioctl command is the "wait_queue_entry_token" number to the ioctl command is the "wait_queue_token" number
corresponding to the notification being acknowledged. corresponding to the notification being acknowledged.
- **AUTOFS_IOC_FAIL**: similar to above, but indicates failure with - **AUTOFS_IOC_FAIL**: similar to above, but indicates failure with
the error code `ENOENT`. the error code `ENOENT`.
...@@ -382,14 +382,14 @@ The available ioctl commands are: ...@@ -382,14 +382,14 @@ The available ioctl commands are:
struct autofs_packet_expire_multi { struct autofs_packet_expire_multi {
int proto_version; /* Protocol version */ int proto_version; /* Protocol version */
int type; /* Type of packet */ int type; /* Type of packet */
autofs_wqt_t wait_queue_entry_token; autofs_wqt_t wait_queue_token;
int len; int len;
char name[NAME_MAX+1]; char name[NAME_MAX+1];
}; };
is required. This is filled in with the name of something is required. This is filled in with the name of something
that can be unmounted or removed. If nothing can be expired, that can be unmounted or removed. If nothing can be expired,
`errno` is set to `EAGAIN`. Even though a `wait_queue_entry_token` `errno` is set to `EAGAIN`. Even though a `wait_queue_token`
is present in the structure, no "wait queue" is established is present in the structure, no "wait queue" is established
and no acknowledgment is needed. and no acknowledgment is needed.
- **AUTOFS_IOC_EXPIRE_MULTI**: This is similar to - **AUTOFS_IOC_EXPIRE_MULTI**: This is similar to
......
...@@ -83,7 +83,7 @@ struct autofs_info { ...@@ -83,7 +83,7 @@ struct autofs_info {
struct autofs_wait_queue { struct autofs_wait_queue {
wait_queue_head_t queue; wait_queue_head_t queue;
struct autofs_wait_queue *next; struct autofs_wait_queue *next;
autofs_wqt_t wait_queue_entry_token; autofs_wqt_t wait_queue_token;
/* We use the following to see what we are waiting for */ /* We use the following to see what we are waiting for */
struct qstr name; struct qstr name;
u32 dev; u32 dev;
......
...@@ -104,7 +104,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, ...@@ -104,7 +104,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi,
size_t pktsz; size_t pktsz;
pr_debug("wait id = 0x%08lx, name = %.*s, type=%d\n", pr_debug("wait id = 0x%08lx, name = %.*s, type=%d\n",
(unsigned long) wq->wait_queue_entry_token, (unsigned long) wq->wait_queue_token,
wq->name.len, wq->name.name, type); wq->name.len, wq->name.name, type);
memset(&pkt, 0, sizeof(pkt)); /* For security reasons */ memset(&pkt, 0, sizeof(pkt)); /* For security reasons */
...@@ -120,7 +120,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, ...@@ -120,7 +120,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi,
pktsz = sizeof(*mp); pktsz = sizeof(*mp);
mp->wait_queue_entry_token = wq->wait_queue_entry_token; mp->wait_queue_token = wq->wait_queue_token;
mp->len = wq->name.len; mp->len = wq->name.len;
memcpy(mp->name, wq->name.name, wq->name.len); memcpy(mp->name, wq->name.name, wq->name.len);
mp->name[wq->name.len] = '\0'; mp->name[wq->name.len] = '\0';
...@@ -133,7 +133,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, ...@@ -133,7 +133,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi,
pktsz = sizeof(*ep); pktsz = sizeof(*ep);
ep->wait_queue_entry_token = wq->wait_queue_entry_token; ep->wait_queue_token = wq->wait_queue_token;
ep->len = wq->name.len; ep->len = wq->name.len;
memcpy(ep->name, wq->name.name, wq->name.len); memcpy(ep->name, wq->name.name, wq->name.len);
ep->name[wq->name.len] = '\0'; ep->name[wq->name.len] = '\0';
...@@ -153,7 +153,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, ...@@ -153,7 +153,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi,
pktsz = sizeof(*packet); pktsz = sizeof(*packet);
packet->wait_queue_entry_token = wq->wait_queue_entry_token; packet->wait_queue_token = wq->wait_queue_token;
packet->len = wq->name.len; packet->len = wq->name.len;
memcpy(packet->name, wq->name.name, wq->name.len); memcpy(packet->name, wq->name.name, wq->name.len);
packet->name[wq->name.len] = '\0'; packet->name[wq->name.len] = '\0';
...@@ -428,7 +428,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, ...@@ -428,7 +428,7 @@ int autofs4_wait(struct autofs_sb_info *sbi,
return -ENOMEM; return -ENOMEM;
} }
wq->wait_queue_entry_token = autofs4_next_wait_queue; wq->wait_queue_token = autofs4_next_wait_queue;
if (++autofs4_next_wait_queue == 0) if (++autofs4_next_wait_queue == 0)
autofs4_next_wait_queue = 1; autofs4_next_wait_queue = 1;
wq->next = sbi->queues; wq->next = sbi->queues;
...@@ -461,7 +461,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, ...@@ -461,7 +461,7 @@ int autofs4_wait(struct autofs_sb_info *sbi,
} }
pr_debug("new wait id = 0x%08lx, name = %.*s, nfy=%d\n", pr_debug("new wait id = 0x%08lx, name = %.*s, nfy=%d\n",
(unsigned long) wq->wait_queue_entry_token, wq->name.len, (unsigned long) wq->wait_queue_token, wq->name.len,
wq->name.name, notify); wq->name.name, notify);
/* /*
...@@ -471,7 +471,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, ...@@ -471,7 +471,7 @@ int autofs4_wait(struct autofs_sb_info *sbi,
} else { } else {
wq->wait_ctr++; wq->wait_ctr++;
pr_debug("existing wait id = 0x%08lx, name = %.*s, nfy=%d\n", pr_debug("existing wait id = 0x%08lx, name = %.*s, nfy=%d\n",
(unsigned long) wq->wait_queue_entry_token, wq->name.len, (unsigned long) wq->wait_queue_token, wq->name.len,
wq->name.name, notify); wq->name.name, notify);
mutex_unlock(&sbi->wq_mutex); mutex_unlock(&sbi->wq_mutex);
kfree(qstr.name); kfree(qstr.name);
...@@ -550,13 +550,13 @@ int autofs4_wait(struct autofs_sb_info *sbi, ...@@ -550,13 +550,13 @@ int autofs4_wait(struct autofs_sb_info *sbi,
} }
int autofs4_wait_release(struct autofs_sb_info *sbi, autofs_wqt_t wait_queue_entry_token, int status) int autofs4_wait_release(struct autofs_sb_info *sbi, autofs_wqt_t wait_queue_token, int status)
{ {
struct autofs_wait_queue *wq, **wql; struct autofs_wait_queue *wq, **wql;
mutex_lock(&sbi->wq_mutex); mutex_lock(&sbi->wq_mutex);
for (wql = &sbi->queues; (wq = *wql) != NULL; wql = &wq->next) { for (wql = &sbi->queues; (wq = *wql) != NULL; wql = &wq->next) {
if (wq->wait_queue_entry_token == wait_queue_entry_token) if (wq->wait_queue_token == wait_queue_token)
break; break;
} }
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#define AUTOFS_MIN_PROTO_VERSION AUTOFS_PROTO_VERSION #define AUTOFS_MIN_PROTO_VERSION AUTOFS_PROTO_VERSION
/* /*
* The wait_queue_entry_token (autofs_wqt_t) is part of a structure which is passed * The wait_queue_token (autofs_wqt_t) is part of a structure which is passed
* back to the kernel via ioctl from userspace. On architectures where 32- and * back to the kernel via ioctl from userspace. On architectures where 32- and
* 64-bit userspace binaries can be executed it's important that the size of * 64-bit userspace binaries can be executed it's important that the size of
* autofs_wqt_t stays constant between 32- and 64-bit Linux kernels so that we * autofs_wqt_t stays constant between 32- and 64-bit Linux kernels so that we
...@@ -49,7 +49,7 @@ struct autofs_packet_hdr { ...@@ -49,7 +49,7 @@ struct autofs_packet_hdr {
struct autofs_packet_missing { struct autofs_packet_missing {
struct autofs_packet_hdr hdr; struct autofs_packet_hdr hdr;
autofs_wqt_t wait_queue_entry_token; autofs_wqt_t wait_queue_token;
int len; int len;
char name[NAME_MAX+1]; char name[NAME_MAX+1];
}; };
......
...@@ -108,7 +108,7 @@ enum autofs_notify { ...@@ -108,7 +108,7 @@ enum autofs_notify {
/* v4 multi expire (via pipe) */ /* v4 multi expire (via pipe) */
struct autofs_packet_expire_multi { struct autofs_packet_expire_multi {
struct autofs_packet_hdr hdr; struct autofs_packet_hdr hdr;
autofs_wqt_t wait_queue_entry_token; autofs_wqt_t wait_queue_token;
int len; int len;
char name[NAME_MAX+1]; char name[NAME_MAX+1];
}; };
...@@ -123,7 +123,7 @@ union autofs_packet_union { ...@@ -123,7 +123,7 @@ union autofs_packet_union {
/* autofs v5 common packet struct */ /* autofs v5 common packet struct */
struct autofs_v5_packet { struct autofs_v5_packet {
struct autofs_packet_hdr hdr; struct autofs_packet_hdr hdr;
autofs_wqt_t wait_queue_entry_token; autofs_wqt_t wait_queue_token;
__u32 dev; __u32 dev;
__u64 ino; __u64 ino;
__u32 uid; __u32 uid;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment