Skip to contentSkip to conversation

Increase number of retries

PATCH New Ritesh Raj Sarraf 1 participant 2 messages May 15, 2015 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Increase number of retries

There have been 3 bug reports so far, that claim increasing the number of retries allows clean up of loop device

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=785251
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=734794
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=608737

I can't be sure if this is the ideal number of retries, but for many users it seems to have solved the error

---
 kpartx/lopart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kpartx/lopart.c +1 -1
index 6f83048..fc1ff85 100644
@@ -288,7 +288,7 @@ set_loop (const char *device, const char *file, int offset, int *loopro)
 extern int 
 del_loop (const char *device)
 {
-	int retries = 3;
+	int retries = 5;
 	int fd;
 
 	if ((fd = open (device, O_RDONLY)) < 0) {
Signature · 1 line
2.1.4
#1 lore raw

PATCH 2/2 Display error when we fail to delete device

We are exiting when the device fails, so also print an error message

---
 kpartx/kpartx.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
kpartx/kpartx.c +2 -3
index d69f9af..8a13c16 100644
@@ -448,9 +448,8 @@ main(int argc, char **argv){
 
 			if (S_ISREG (buf.st_mode)) {
 				if (del_loop(device)) {
-					if (verbose)
-						printf("can't del loop : %s\n",
-							device);
+					printf("can't del loop : %s\n",
+						device);
 					exit(1);
 				}
 				printf("loop deleted : %s\n", device);
Signature · 1 line
2.1.4