CEPH filesystem development
 help / color / mirror / Atom feed
* [PATCH] rbd: fix bug in rbd_dev_id_put()
@ 2012-10-11 15:34 Alex Elder
  2012-10-24 16:43 ` Josh Durgin
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Elder @ 2012-10-11 15:34 UTC (permalink / raw)
  To: ceph-devel

In rbd_dev_id_put(), there's a loop that's intended to determine
the maximum device id in use.  But it isn't doing that at all,
the effect of how it's written is to simply use the just-put id
number, which ignores whole purpose of this function.

Fix the bug.

Signed-off-by: Alex Elder <elder@inktank.com>
---
  drivers/block/rbd.c |    4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index ca28036..cf5d109 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2642,8 +2642,8 @@ static void rbd_dev_id_put(struct rbd_device *rbd_dev)
  		struct rbd_device *rbd_dev;

  		rbd_dev = list_entry(tmp, struct rbd_device, node);
-		if (rbd_id > max_id)
-			max_id = rbd_id;
+		if (rbd_dev->dev_id > max_id)
+			max_id = rbd_dev->dev_id;
  	}
  	spin_unlock(&rbd_dev_list_lock);

-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] rbd: fix bug in rbd_dev_id_put()
  2012-10-11 15:34 [PATCH] rbd: fix bug in rbd_dev_id_put() Alex Elder
@ 2012-10-24 16:43 ` Josh Durgin
  0 siblings, 0 replies; 2+ messages in thread
From: Josh Durgin @ 2012-10-24 16:43 UTC (permalink / raw)
  To: Alex Elder; +Cc: ceph-devel

Reviewed-by: Josh Durgin <josh.durgin@inktank.com>

On 10/11/2012 08:34 AM, Alex Elder wrote:
> In rbd_dev_id_put(), there's a loop that's intended to determine
> the maximum device id in use.  But it isn't doing that at all,
> the effect of how it's written is to simply use the just-put id
> number, which ignores whole purpose of this function.
>
> Fix the bug.
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
>   drivers/block/rbd.c |    4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index ca28036..cf5d109 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -2642,8 +2642,8 @@ static void rbd_dev_id_put(struct rbd_device
> *rbd_dev)
>           struct rbd_device *rbd_dev;
>
>           rbd_dev = list_entry(tmp, struct rbd_device, node);
> -        if (rbd_id > max_id)
> -            max_id = rbd_id;
> +        if (rbd_dev->dev_id > max_id)
> +            max_id = rbd_dev->dev_id;
>       }
>       spin_unlock(&rbd_dev_list_lock);
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-10-24 16:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-11 15:34 [PATCH] rbd: fix bug in rbd_dev_id_put() Alex Elder
2012-10-24 16:43 ` Josh Durgin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox