Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Nov 2006 10:09:56 -0800 (PST)
From:      Shane Adams <adamsch1@yahoo.com>
To:        Eric Anderson <anderson@centtech.com>
Cc:        freebsd-geom@freebsd.org
Subject:   Re: g_access questions (Out on a limb here)
Message-ID:  <20061115180956.68290.qmail@web31809.mail.mud.yahoo.com>

next in thread | raw e-mail | index | archive | help
Thanks for the reply,=0A=0ACan you mount the same device/file more than onc=
e at a time?=0A=0AShane=0A=0A=0A----- Original Message ----=0AFrom: Eric An=
derson <anderson@centtech.com>=0ATo: Shane Adams <adamsch1@yahoo.com>=0ACc:=
 freebsd-geom@freebsd.org=0ASent: Wednesday, November 15, 2006 6:03:35 AM=
=0ASubject: Re: g_access questions (Out on a limb here)=0A=0AOn 11/14/06 17=
:00, Shane Adams wrote:=0A> Hello,=0A> =0A> I have a question regarding g_a=
ccess.  I'm mounting a custom filesytem twice against the same device.  The=
 first time I'm mounting it with read/write access, I then mount the same d=
evice to a different mount point.  After I do this, the first mount starts =
getting write errors, so somehow the second mount is screwing up access rig=
hts to the device.  For what its worth, I'm mounting a ram backed mdconfig =
device.=0A> =0A> I'm not sure if this is a geom related issue, or related t=
o the fact that you cannot mount a device more than twice in vfs?=0A> =0A> =
Anyway - the first time I mount (R/W) I do:=0A> =0A> g_access(cp, 1,1, 0)=
=0A> =0A> I then mount the device again as read only to a different mount p=
oint with =0A> =0A> g_access(cp,1,0,0)=0A> =0A> The code I used is taken fr=
om g_vfs_open with wr flag set depending if write access is required:=0A> =
=0A>    pp =3D g_dev_getprovider(vp->v_rdev);=0A>         if (pp =3D=3D NUL=
L)=0A>                 return (ENOENT);=0A>         gp =3D g_new_geomf(&g_v=
fs_class2, "%s.%s", fsname, pp->name);=0A>         cp =3D g_new_consumer(gp=
);=0A>         g_attach(cp, pp);=0A>         error =3D g_access(cp, 1, wr, =
0);=0A>         if (error) {=0A>                 g_wither_geom(gp, ENXIO);=
=0A>                 return (error);=0A>         }=0A=0A=0AInteresting.. I'=
m mounting a custom file system also, and I'm doing it =0Amuch differently:=
=0A=0A[...]=0A    struct vnode *devvp;    /* vnode of the mount device */=
=0A    struct g_consumer *cp;=0A[...]=0A    DROP_GIANT();=0A    g_topology_=
lock();=0A    error =3D g_vfs_open(devvp, &cp, "tarfs", 0);=0A    g_topolog=
y_unlock();=0A    PICKUP_GIANT();=0A    VOP_UNLOCK(devvp, 0, td);=0A[...]=
=0A=0A=0AEric=0A=0A=0A=0A-- =0A--------------------------------------------=
----------------------------=0AEric Anderson        Sr. Systems Administrat=
or        Centaur Technology=0AAnything that works is better than anything =
that doesn't.=0A-----------------------------------------------------------=
-------------=0A_______________________________________________=0Afreebsd-g=
eom@freebsd.org mailing list=0Ahttp://lists.freebsd.org/mailman/listinfo/fr=
eebsd-geom=0ATo unsubscribe, send any mail to "freebsd-geom-unsubscribe@fre=
ebsd.org"=0A=0A=0A=0A=0A=0A =0A____________________________________________=
________________________________________=0ASponsored Link=0A=0A$420k for $1=
,399/mo. =0AThink You Pay Too Much For Your Mortgage? =0AFind Out! www.Lowe=
rMyBills.com/lre



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061115180956.68290.qmail>