Re: [PATCH] mount: retry on ENOMEDIUM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 09, 2008 at 04:38:25PM +0200, Matthias Koenig wrote:
> Due to a change in kernel behaviour when opening CDROM devices,
> we need to retry the open/mount call when ENOMEDIUM is returned.

 I need to test this a little. We probably need a patch to libblkid
 too.

> It seems the only way to work around the problem is via sensible
> retries (e.g.  try three times 5 secs apart) and I don't think we can

 :-((

> diff --git a/mount/fsprobe_volumeid.c b/mount/fsprobe_volumeid.c
> index 7c98dc6..1ef788c 100644
> --- a/mount/fsprobe_volumeid.c
> +++ b/mount/fsprobe_volumeid.c
>
> +#define MAX_RETRIES 5

> diff --git a/mount/mount.c b/mount/mount.c
> index bed792d..5d50bca 100644
> --- a/mount/mount.c
> +++ b/mount/mount.c
>
> +#define MAX_RETRIES 5

 it would be better to rename it to MAX_ENOMEDIUM_RETRIES and move
 this definition to sundries.h.

> @@ -1363,6 +1366,14 @@ try_mount_one (const char *spec0, const char *node0, const char *types0,
>        }
>        break;
>      }
> +    case ENOMEDIUM:
> +      if (retries < MAX_RETRIES) {
> +              ++retries;

if (verbose)
    printf(_("mount: %s: no medium ...trying again\n", spec);

> +              sleep(3);
> +              goto mount_retry;
> +      }
> +      error(_("mount: No medium found on %s"), spec);
> +      break;
>      default:
>        error ("mount: %s", strerror (mnt_err)); break;
>      }

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux