History

do_epoll_ctl(): clean the failure exits up a bit

Al Viro committed 6 years ago

Commit 52c47961 parent a9ed4a61 file · +6 −13Browse files

Unified · Split

fs/eventpoll.c+6−13
@@ -2203,29 +2203,22 @@ int do_epoll_ctl(int epfd, int op, int fd, struct epoll_event *epds, · 2202 unmodified lines
22032203 full_check = 1;
22042204 if (is_file_epoll(tf.file)) {
22052205 error = -ELOOP;
2206− if (ep_loop_check(ep, tf.file) != 0) {
2207− clear_tfile_check_list();
2206+ if (ep_loop_check(ep, tf.file) != 0)
22082207 goto error_tgt_fput;
2209− }
22102208 } else {
22112209 get_file(tf.file);
22122210 list_add(&tf.file->f_tfile_llink,
22132211 &tfile_check_list);
22142212 }
22152213 error = epoll_mutex_lock(&ep->mtx, 0, nonblock);
2216− if (error) {
2217−out_del:
2218− list_del(&tf.file->f_tfile_llink);
2219− if (!is_file_epoll(tf.file))
2220− fput(tf.file);
2214+ if (error)
22212215 goto error_tgt_fput;
2222− }
22232216 if (is_file_epoll(tf.file)) {
22242217 tep = tf.file->private_data;
22252218 error = epoll_mutex_lock(&tep->mtx, 1, nonblock);
22262219 if (error) {
22272220 mutex_unlock(&ep->mtx);
2228− goto out_del;
2221+ goto error_tgt_fput;
22292222 }
22302223 }
22312224 }
@@ -2246,8 +2239,6 @@ out_del: · 14 unmodified lines
22462239 error = ep_insert(ep, epds, tf.file, fd, full_check);
22472240 } else
22482241 error = -EEXIST;
2249− if (full_check)
2250− clear_tfile_check_list();
22512242 break;
22522243 case EPOLL_CTL_DEL:
22532244 if (epi)
@@ -2270,8 +2261,10 @@ out_del: · 16 unmodified lines
22702261 mutex_unlock(&ep->mtx);
22712262
22722263 error_tgt_fput:
2273− if (full_check)
2264+ if (full_check) {
2265+ clear_tfile_check_list();
22742266 mutex_unlock(&epmutex);
2267+ }
22752268
22762269 fdput(tf);
22772270 error_fput: