Repository navigation
Commit 0539097
rbd: fix rbd_dev_parent_get() when parent_overlap == 0
commit ae43e9d upstream.
The comment for rbd_dev_parent_get() said
* We must get the reference before checking for the overlap to
* coordinate properly with zeroing the parent overlap in
* rbd_dev_v2_parent_info() when an image gets flattened. We
* drop it again if there is no overlap.
but the "drop it again if there is no overlap" part was missing from
the implementation. This lead to absurd parent_ref values for images
with parent_overlap == 0, as parent_ref was incremented for each
img_request and virtually never decremented.
Fix this by leveraging the fact that refresh path calls
rbd_dev_v2_parent_info() under header_rwsem and use it for read in
rbd_dev_parent_get(), instead of messing around with atomics. Get rid
of barriers in rbd_dev_v2_parent_info() while at it - I don't see what
they'd pair with now and I suspect we are in a pretty miserable
situation as far as proper locking goes regardless.
Signed-off-by: Ilya Dryomov <idryomov@redhat.com>
Reviewed-by: Josh Durgin <jdurgin@redhat.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 186eb06 commit 0539097
1 file changed
Lines changed: 6 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2098 | 2098 | | |
2099 | 2099 | | |
2100 | 2100 | | |
2101 | | - | |
2102 | | - | |
2103 | | - | |
2104 | | - | |
2105 | | - | |
2106 | 2101 | | |
2107 | 2102 | | |
2108 | 2103 | | |
2109 | 2104 | | |
2110 | 2105 | | |
2111 | 2106 | | |
2112 | | - | |
| 2107 | + | |
2113 | 2108 | | |
2114 | 2109 | | |
2115 | 2110 | | |
2116 | 2111 | | |
2117 | | - | |
2118 | | - | |
2119 | | - | |
2120 | | - | |
2121 | | - | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
| 2115 | + | |
2122 | 2116 | | |
2123 | 2117 | | |
2124 | 2118 | | |
2125 | 2119 | | |
2126 | | - | |
| 2120 | + | |
2127 | 2121 | | |
2128 | 2122 | | |
2129 | 2123 | | |
| |||
4236 | 4230 | | |
4237 | 4231 | | |
4238 | 4232 | | |
4239 | | - | |
4240 | 4233 | | |
4241 | 4234 | | |
4242 | 4235 | | |
| |||
4282 | 4275 | | |
4283 | 4276 | | |
4284 | 4277 | | |
4285 | | - | |
4286 | 4278 | | |
4287 | 4279 | | |
4288 | 4280 | | |
| |||
0 commit comments