Commit 9a2d93899897efb0702f97e71387f9d0ae94a9d5
Committed by
David S. Miller
1 parent
259e60f967
net: sched: flower: handle concurrent filter insertion in fl_change
Check if user specified a handle and another filter with the same handle was inserted concurrently. Return EAGAIN to retry filter processing (in case it is an overwrite request). Signed-off-by: Vlad Buslov <vladbu@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Reviewed-by: Stefano Brivio <sbrivio@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 9 additions and 0 deletions Side-by-side Diff
net/sched/cls_flower.c
... | ... | @@ -1542,6 +1542,15 @@ |
1542 | 1542 | /* user specifies a handle and it doesn't exist */ |
1543 | 1543 | err = idr_alloc_u32(&head->handle_idr, fnew, &handle, |
1544 | 1544 | handle, GFP_ATOMIC); |
1545 | + | |
1546 | + /* Filter with specified handle was concurrently | |
1547 | + * inserted after initial check in cls_api. This is not | |
1548 | + * necessarily an error if NLM_F_EXCL is not set in | |
1549 | + * message flags. Returning EAGAIN will cause cls_api to | |
1550 | + * try to update concurrently inserted rule. | |
1551 | + */ | |
1552 | + if (err == -ENOSPC) | |
1553 | + err = -EAGAIN; | |
1545 | 1554 | } else { |
1546 | 1555 | handle = 1; |
1547 | 1556 | err = idr_alloc_u32(&head->handle_idr, fnew, &handle, |