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
316316 struct autofs_v5_packet {
317317 int proto_version; /* Protocol version */
318318 int type; /* Type of packet */
319− autofs_wqt_t wait_queue_entry_token;
319+ autofs_wqt_t wait_queue_token;
320320 __u32 dev;
321321 __u64 ino;
322322 __u32 uid;
@@ -341,12 +341,12 @@ The pipe will be set to "packet mode" (equivalent to passing · 18 unmodified lines
341341 `O_DIRECT`) to _pipe2(2)_ so that a read from the pipe will return at
342342 most one packet, and any unread portion of a packet will be discarded.
343343
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
345345 particular request to be acknowledged. When a message is sent over
346346 the pipe the affected dentry is marked as either "active" or
347347 "expiring" and other accesses to it block until the message is
348348 acknowledged using one of the ioctls below and the relevant
349−`wait_queue_entry_token`.
349+`wait_queue_token`.
350350
351351 Communicating with autofs: root directory ioctls
352352 ------------------------------------------------
@@ -358,7 +358,7 @@ capability, or must be the automount daemon. · 5 unmodified lines
358358 The available ioctl commands are:
359359
360360 - **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
362362 corresponding to the notification being acknowledged.
363363 - **AUTOFS_IOC_FAIL**: similar to above, but indicates failure with
364364 the error code `ENOENT`.
@@ -382,14 +382,14 @@ The available ioctl commands are: · 17 unmodified lines
382382 struct autofs_packet_expire_multi {
383383 int proto_version; /* Protocol version */
384384 int type; /* Type of packet */
385− autofs_wqt_t wait_queue_entry_token;
385+ autofs_wqt_t wait_queue_token;
386386 int len;
387387 char name[NAME_MAX+1];
388388 };
389389
390390 is required. This is filled in with the name of something
391391 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`
393393 is present in the structure, no "wait queue" is established
394394 and no acknowledgment is needed.
395395 - **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
8383 struct autofs_wait_queue {
8484 wait_queue_head_t queue;
8585 struct autofs_wait_queue *next;
86− autofs_wqt_t wait_queue_entry_token;
86+ autofs_wqt_t wait_queue_token;
8787 /* We use the following to see what we are waiting for */
8888 struct qstr name;
8989 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
104104 size_t pktsz;
105105
106106 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,
108108 wq->name.len, wq->name.name, type);
109109
110110 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
120120
121121 pktsz = sizeof(*mp);
122122
123− mp->wait_queue_entry_token = wq->wait_queue_entry_token;
123+ mp->wait_queue_token = wq->wait_queue_token;
124124 mp->len = wq->name.len;
125125 memcpy(mp->name, wq->name.name, wq->name.len);
126126 mp->name[wq->name.len] = '\0';
@@ -133,7 +133,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, · 6 unmodified lines
133133
134134 pktsz = sizeof(*ep);
135135
136− ep->wait_queue_entry_token = wq->wait_queue_entry_token;
136+ ep->wait_queue_token = wq->wait_queue_token;
137137 ep->len = wq->name.len;
138138 memcpy(ep->name, wq->name.name, wq->name.len);
139139 ep->name[wq->name.len] = '\0';
@@ -153,7 +153,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, · 13 unmodified lines
153153
154154 pktsz = sizeof(*packet);
155155
156− packet->wait_queue_entry_token = wq->wait_queue_entry_token;
156+ packet->wait_queue_token = wq->wait_queue_token;
157157 packet->len = wq->name.len;
158158 memcpy(packet->name, wq->name.name, wq->name.len);
159159 packet->name[wq->name.len] = '\0';
@@ -428,7 +428,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, · 268 unmodified lines
428428 return -ENOMEM;
429429 }
430430
431− wq->wait_queue_entry_token = autofs4_next_wait_queue;
431+ wq->wait_queue_token = autofs4_next_wait_queue;
432432 if (++autofs4_next_wait_queue == 0)
433433 autofs4_next_wait_queue = 1;
434434 wq->next = sbi->queues;
@@ -461,7 +461,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, · 26 unmodified lines
461461 }
462462
463463 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,
465465 wq->name.name, notify);
466466
467467 /*
@@ -471,7 +471,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, · 3 unmodified lines
471471 } else {
472472 wq->wait_ctr++;
473473 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,
475475 wq->name.name, notify);
476476 mutex_unlock(&sbi->wq_mutex);
477477 kfree(qstr.name);
@@ -550,13 +550,13 @@ int autofs4_wait(struct autofs_sb_info *sbi, · 72 unmodified lines
550550 }
551551
552552
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)
554554 {
555555 struct autofs_wait_queue *wq, **wql;
556556
557557 mutex_lock(&sbi->wq_mutex);
558558 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)
560560 break;
561561 }
562562
include/uapi/linux/auto_fs.h+2−2
@@ -26,7 +26,7 @@ · 25 unmodified lines
2626 #define AUTOFS_MIN_PROTO_VERSION AUTOFS_PROTO_VERSION
2727
2828 /*
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
3030 * back to the kernel via ioctl from userspace. On architectures where 32- and
3131 * 64-bit userspace binaries can be executed it's important that the size of
3232 * 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
4949
5050 struct autofs_packet_missing {
5151 struct autofs_packet_hdr hdr;
52− autofs_wqt_t wait_queue_entry_token;
52+ autofs_wqt_t wait_queue_token;
5353 int len;
5454 char name[NAME_MAX+1];
5555 };
include/uapi/linux/auto_fs4.h+2−2
@@ -108,7 +108,7 @@ enum autofs_notify { · 107 unmodified lines
108108 /* v4 multi expire (via pipe) */
109109 struct autofs_packet_expire_multi {
110110 struct autofs_packet_hdr hdr;
111− autofs_wqt_t wait_queue_entry_token;
111+ autofs_wqt_t wait_queue_token;
112112 int len;
113113 char name[NAME_MAX+1];
114114 };
@@ -123,7 +123,7 @@ union autofs_packet_union { · 8 unmodified lines
123123 /* autofs v5 common packet struct */
124124 struct autofs_v5_packet {
125125 struct autofs_packet_hdr hdr;
126− autofs_wqt_t wait_queue_entry_token;
126+ autofs_wqt_t wait_queue_token;
127127 __u32 dev;
128128 __u64 ino;
129129 __u32 uid;