File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -432,7 +432,27 @@ int main(int argc, char **argv)
432432 waitpid (son , & status , 0 );
433433
434434 chdir ("/" );
435- umount (OPK_MOUNTPOINT );
435+
436+ /** Multiple trials to unmount OPK_MOUNTPOINT */
437+ #define MAX_UMOUNT_TRIALS 100
438+ int retries = MAX_UMOUNT_TRIALS ;
439+ int res = -1 ;
440+ while (retries && res ){
441+ res = umount (OPK_MOUNTPOINT );
442+ /*printf("Res %d umounting %s, trial %d/%d\n",
443+ res, OPK_MOUNTPOINT, MAX_UMOUNT_TRIALS-retries+1, MAX_UMOUNT_TRIALS);*/
444+
445+ if (res )
446+ usleep (50 * 1000 );
447+
448+ retries -- ;
449+ }
450+
451+ if (!retries ){
452+ printf ("Error(%d) umounting %s\n" , res , OPK_MOUNTPOINT );
453+ }
454+
455+ /** Voluntarily commented */
436456 //rmdir(OPK_MOUNTPOINT);
437457
438458 ioctl (loopfd , LOOP_CLR_FD , (void * )0 );
You can’t perform that action at this time.
0 commit comments