History

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.

Linus Torvalds committed 9 years ago

Commit 7cee9381 parent 9eb78885 files · +20 −20Browse files

Unified · Split

5 files
  1. Documentation/filesystems/autofs4.txt +6 −6
  2. fs/autofs4/autofs_i.h +1 −1
  3. fs/autofs4/waitq.c +9 −9
  4. include/uapi/linux/auto_fs.h +2 −2
  5. include/uapi/linux/auto_fs4.h +2 −2
Documentation/filesystems/autofs4.txt+6−6
@@ -316,7 +316,7 @@ For version 5, the format of the message is: · 315 unmodified lines
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 · 18 unmodified lines
341`O_DIRECT`) to _pipe2(2)_ so that a read from the pipe will return at341`O_DIRECT`) to _pipe2(2)_ so that a read from the pipe will return at
342most one packet, and any unread portion of a packet will be discarded.342most one packet, and any unread portion of a packet will be discarded.
343 343
344The `wait_queue_entry_token` is a unique number which can identify a344The `wait_queue_token` is a unique number which can identify a
345particular request to be acknowledged. When a message is sent over345particular request to be acknowledged. When a message is sent over
346the pipe the affected dentry is marked as either "active" or346the pipe the affected dentry is marked as either "active" or
347"expiring" and other accesses to it block until the message is347"expiring" and other accesses to it block until the message is
348acknowledged using one of the ioctls below and the relevant348acknowledged using one of the ioctls below and the relevant
349`wait_queue_entry_token`.349`wait_queue_token`.
350 350
351Communicating with autofs: root directory ioctls351Communicating with autofs: root directory ioctls
352------------------------------------------------352------------------------------------------------
@@ -358,7 +358,7 @@ capability, or must be the automount daemon. · 5 unmodified lines
358The available ioctl commands are:358The available ioctl commands are:
359 359
360- **AUTOFS_IOC_READY**: a notification has been handled. The argument360- **AUTOFS_IOC_READY**: a notification has been handled. The argument
361 to the ioctl command is the "wait_queue_entry_token" number361 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 with363- **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: · 17 unmodified lines
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 something390 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 established393 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 to395- **AUTOFS_IOC_EXPIRE_MULTI**: This is similar to
fs/autofs4/autofs_i.h+1−1
@@ -83,7 +83,7 @@ struct autofs_info { · 82 unmodified lines
83struct autofs_wait_queue {83struct 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;
fs/autofs4/waitq.c+9−9
@@ -104,7 +104,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, · 103 unmodified lines
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, · 9 unmodified lines
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, · 6 unmodified lines
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, · 13 unmodified lines
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, · 268 unmodified lines
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, · 26 unmodified lines
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, · 3 unmodified lines
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, · 72 unmodified lines
550}550}
551 551
552 552
553int autofs4_wait_release(struct autofs_sb_info *sbi, autofs_wqt_t wait_queue_entry_token, int status)553int 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
include/uapi/linux/auto_fs.h+2−2
@@ -26,7 +26,7 @@ · 25 unmodified lines
26#define AUTOFS_MIN_PROTO_VERSION AUTOFS_PROTO_VERSION26#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 passed29 * 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- and30 * 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 of31 * 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 we32 * autofs_wqt_t stays constant between 32- and 64-bit Linux kernels so that we
@@ -49,7 +49,7 @@ struct autofs_packet_hdr { · 16 unmodified lines
49 49
50struct autofs_packet_missing {50struct 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};
include/uapi/linux/auto_fs4.h+2−2
@@ -108,7 +108,7 @@ enum autofs_notify { · 107 unmodified lines
108/* v4 multi expire (via pipe) */108/* v4 multi expire (via pipe) */
109struct autofs_packet_expire_multi {109struct 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 { · 8 unmodified lines
123/* autofs v5 common packet struct */123/* autofs v5 common packet struct */
124struct autofs_v5_packet {124struct 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;