Re: [Qemu-devel] [PATCH] block/iscsi: handle BUSY condition

2014-06-06 Thread George-Cristian Bîrzan
We're interested in this patch, is there an updated version (I'd rather not try to fix the deprecated timer function myself), we can try? We have a very easy way to reproduce this problem in Real Life (VMs connecting to a scst target server) so if nothing else we can provide some testing. :) --

Re: [Qemu-devel] [PATCH] block/iscsi: handle BUSY condition

2014-06-05 Thread Peter Lieven
On 30.05.2014 11:05, Paolo Bonzini wrote: Il 30/05/2014 11:04, Peter Lieven ha scritto: Am 30.05.2014 07:50, schrieb Paolo Bonzini: Il 29/05/2014 22:25, Peter Lieven ha scritto: Am 29.05.2014 21:17, schrieb Paolo Bonzini: Il 29/05/2014 20:41, Peter Lieven ha scritto: static inline unsigned

Re: [Qemu-devel] [PATCH] block/iscsi: handle BUSY condition

2014-06-05 Thread Paolo Bonzini
Il 05/06/2014 11:29, Peter Lieven ha scritto: It might be that we need a LIBS+= -lm to the Makefile in the root directory. I had strange problems when linking qemu-img/qemu-io/qemu-nbd. cat $TMPC EOF #include math.h int main(void) { return isnan(sin(0.0)); } EOF if compile_prog ; then :

Re: [Qemu-devel] [PATCH] block/iscsi: handle BUSY condition

2014-06-05 Thread Peter Lieven
On 05.06.2014 11:44, Paolo Bonzini wrote: Il 05/06/2014 11:29, Peter Lieven ha scritto: It might be that we need a LIBS+= -lm to the Makefile in the root directory. I had strange problems when linking qemu-img/qemu-io/qemu-nbd. cat $TMPC EOF #include math.h int main(void) { return

Re: [Qemu-devel] [PATCH] block/iscsi: handle BUSY condition

2014-05-30 Thread Paolo Bonzini
Il 30/05/2014 11:04, Peter Lieven ha scritto: Am 30.05.2014 07:50, schrieb Paolo Bonzini: Il 29/05/2014 22:25, Peter Lieven ha scritto: Am 29.05.2014 21:17, schrieb Paolo Bonzini: Il 29/05/2014 20:41, Peter Lieven ha scritto: static inline unsigned geo_rand_range(double m, double n) {

Re: [Qemu-devel] [PATCH] block/iscsi: handle BUSY condition

2014-05-30 Thread Peter Lieven
Am 30.05.2014 07:50, schrieb Paolo Bonzini: Il 29/05/2014 22:25, Peter Lieven ha scritto: Am 29.05.2014 21:17, schrieb Paolo Bonzini: Il 29/05/2014 20:41, Peter Lieven ha scritto: static inline unsigned geo_rand_range(double m, double n) { return exp((log(m) + (double)rand() /

[Qemu-devel] [PATCH] block/iscsi: handle BUSY condition

2014-05-29 Thread Peter Lieven
this patch adds handling of BUSY status reponse from an iSCSI target. Currently, we fail with -EIO in case of SCSI_STATUS_BUSY while the obvious reaction would be to retry the operation after some time. The retry time is randomly choosen from a range with exponential growth increasing with each

Re: [Qemu-devel] [PATCH] block/iscsi: handle BUSY condition

2014-05-29 Thread Paolo Bonzini
Il 29/05/2014 19:31, Peter Lieven ha scritto: +static const unsigned iscsi_retry_times[] = {4, 16, 64, 256, 1024, 4096}; This is a pretty fast growth. +static void iscsi_retry_timer_expired(void *opaque) +{ +struct IscsiTask *iTask = opaque; +timer_del(iTask-retry_timer); This

Re: [Qemu-devel] [PATCH] block/iscsi: handle BUSY condition

2014-05-29 Thread Peter Lieven
Am 29.05.2014 19:47, schrieb Paolo Bonzini: Il 29/05/2014 19:31, Peter Lieven ha scritto: +static const unsigned iscsi_retry_times[] = {4, 16, 64, 256, 1024, 4096}; This is a pretty fast growth. I know, I wanted to end up with a total retry period of approx. 10 seconds before failing. As we

Re: [Qemu-devel] [PATCH] block/iscsi: handle BUSY condition

2014-05-29 Thread Paolo Bonzini
Il 29/05/2014 20:41, Peter Lieven ha scritto: static inline unsigned geo_rand_range(double m, double n) { return exp((log(m) + (double)rand() / (RAND_MAX / (log(n) - log(m) + log(1)) + log(1; } Yes, exactly (except that log(1) is zero, and was only needed in your case

Re: [Qemu-devel] [PATCH] block/iscsi: handle BUSY condition

2014-05-29 Thread Peter Lieven
Am 29.05.2014 21:17, schrieb Paolo Bonzini: Il 29/05/2014 20:41, Peter Lieven ha scritto: static inline unsigned geo_rand_range(double m, double n) { return exp((log(m) + (double)rand() / (RAND_MAX / (log(n) - log(m) + log(1)) + log(1; } Yes, exactly (except that

Re: [Qemu-devel] [PATCH] block/iscsi: handle BUSY condition

2014-05-29 Thread Peter Lieven
Am 29.05.2014 21:17, schrieb Paolo Bonzini: Il 29/05/2014 20:41, Peter Lieven ha scritto: static inline unsigned geo_rand_range(double m, double n) { return exp((log(m) + (double)rand() / (RAND_MAX / (log(n) - log(m) + log(1)) + log(1; } Yes, exactly (except that

Re: [Qemu-devel] [PATCH] block/iscsi: handle BUSY condition

2014-05-29 Thread Paolo Bonzini
Il 29/05/2014 22:25, Peter Lieven ha scritto: Am 29.05.2014 21:17, schrieb Paolo Bonzini: Il 29/05/2014 20:41, Peter Lieven ha scritto: static inline unsigned geo_rand_range(double m, double n) { return exp((log(m) + (double)rand() / (RAND_MAX / (log(n) - log(m) + log(1)) +