[PATCH] do not stat autofs mounts(was Re: hall and autofs)
John (J5) Palmieri
johnp at redhat.com
Fri May 19 23:38:12 PDT 2006
On Sat, 2006-05-20 at 11:19 +0800, Ian Kent wrote:
> On Wed, 2006-05-17 at 18:55 -0400, John (J5) Palmieri wrote:
> ? .blockdev.c.swp
> ? hal-donot-check-created-by-hal-on-autofs-mounts-2.patch
> ? hal-donot-check-created-by-hal-on-autofs-mounts-3.patch
> ? hal-donot-check-created-by-hal-on-autofs-mounts.patch
> ? hal-donot-stat-autofs-mounts.patch
> Index: blockdev.c
> ===================================================================
> RCS file: /cvs/hal/hal/hald/linux2/blockdev.c,v
> retrieving revision 1.41
> diff -u -r1.41 blockdev.c
> --- blockdev.c 9 May 2006 20:13:42 -0000 1.41
> +++ blockdev.c 17 May 2006 22:53:13 -0000
> @@ -185,6 +185,7 @@
> dev_t devt = makedev(0, 0);
> GSList *volumes = NULL;
> GSList *volume;
> + GSList *autofs_mounts = NULL;
>
> /* open /proc/mounts */
> g_snprintf (buf, sizeof (buf), "%s/mounts", get_hal_proc_path ());
> @@ -213,6 +214,28 @@
> if (strcmp(mnt.mnt_type, "nfs") == 0)
> continue;
>
> + /* If this is an autofs mount (fstype == 'autofs')
> + * store the mount in a list for later use.
> + * On mounts managed by autofs accessing files below the mount
> + * point cause the mount point to be remounted after an
> + * unmount. We keep the list so we do not check for
> + * the .created-by-hal file on mounts under autofs mount points
> + */
> + if (strcmp(mnt.mnt_type, "autofs") == 0) {
> + char *mnt_dir;
> +
> + if (mnt.mnt_dir[strlen (mnt.mnt_dir) - 1] != '/')
> + mnt_dir = g_strdup_printf ("%s/", mnt.mnt_dir);
>
> Is this right?
>
> The slash won't appear in /proc/mounts.
> Is it needed at all as the fact that it's an autofs filesystem should
> exclude other media that's present in the fstab.
It is used for comparison later on so if /m is an autofs mount we don't
exclude /media. Of course if the kernel ABI is stable here *faint
chuckle* We could just add the slash to the end of the directory without
the comparison. Personally I don't think it hurts and is more robust to
check for the slash.
--
John (J5) Palmieri <johnp at redhat.com>
More information about the hal
mailing list