* [PATCH] rbd: Avoid calling BUG() when object_map is not empty
@ 2019-12-15 16:35 Aditya Pakki
2019-12-15 22:00 ` Markus Elfring
2019-12-16 10:18 ` Ilya Dryomov
0 siblings, 2 replies; 3+ messages in thread
From: Aditya Pakki @ 2019-12-15 16:35 UTC (permalink / raw)
To: pakki001
Cc: kjlu, Ilya Dryomov, Sage Weil, Dongsheng Yang, Jens Axboe,
ceph-devel, linux-block, linux-kernel
In __rbd_object_map_load, if object_map contains data, return
error -EINVAL upstream, instead of crashing, via BUG. The patch
fixes this issue.
Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
drivers/block/rbd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 2b184563cd32..6e9a11f32a94 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1892,7 +1892,8 @@ static int __rbd_object_map_load(struct rbd_device *rbd_dev)
int num_pages;
int ret;
- rbd_assert(!rbd_dev->object_map && !rbd_dev->object_map_size);
+ if (rbd_dev->object_map || rbd_dev->object_map_size)
+ return -EINVAL;
num_objects = ceph_get_num_objects(&rbd_dev->layout,
rbd_dev->mapping.size);
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] rbd: Avoid calling BUG() when object_map is not empty
2019-12-15 16:35 [PATCH] rbd: Avoid calling BUG() when object_map is not empty Aditya Pakki
@ 2019-12-15 22:00 ` Markus Elfring
2019-12-16 10:18 ` Ilya Dryomov
1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2019-12-15 22:00 UTC (permalink / raw)
To: Aditya Pakki, ceph-devel, linux-block
Cc: linux-kernel, Dongsheng Yang, Ilya Dryomov, Jens Axboe,
Kangjie Lu, Sage Weil
> The patch fixes this issue.
Will the tag “Fixes” be more helpful than this sentence?
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rbd: Avoid calling BUG() when object_map is not empty
2019-12-15 16:35 [PATCH] rbd: Avoid calling BUG() when object_map is not empty Aditya Pakki
2019-12-15 22:00 ` Markus Elfring
@ 2019-12-16 10:18 ` Ilya Dryomov
1 sibling, 0 replies; 3+ messages in thread
From: Ilya Dryomov @ 2019-12-16 10:18 UTC (permalink / raw)
To: Aditya Pakki
Cc: kjlu, Sage Weil, Dongsheng Yang, Jens Axboe, Ceph Development,
linux-block, LKML
On Sun, Dec 15, 2019 at 5:35 PM Aditya Pakki <pakki001@umn.edu> wrote:
>
> In __rbd_object_map_load, if object_map contains data, return
> error -EINVAL upstream, instead of crashing, via BUG. The patch
> fixes this issue.
>
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---
> drivers/block/rbd.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 2b184563cd32..6e9a11f32a94 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -1892,7 +1892,8 @@ static int __rbd_object_map_load(struct rbd_device *rbd_dev)
> int num_pages;
> int ret;
>
> - rbd_assert(!rbd_dev->object_map && !rbd_dev->object_map_size);
> + if (rbd_dev->object_map || rbd_dev->object_map_size)
> + return -EINVAL;
>
> num_objects = ceph_get_num_objects(&rbd_dev->layout,
> rbd_dev->mapping.size);
Hi Aditya,
Could you explain what issue is being fixed? Did you hit this assert?
If so, under what circumstances? The fact that __rbd_object_map_load()
can fail doesn't mean that it shouldn't have asserts...
Thanks,
Ilya
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-12-16 10:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-15 16:35 [PATCH] rbd: Avoid calling BUG() when object_map is not empty Aditya Pakki
2019-12-15 22:00 ` Markus Elfring
2019-12-16 10:18 ` Ilya Dryomov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.