+2003-10-02 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
+
+ Use NFS V2/V3 file handles instead of mount results.
+
+ * include/am_utils.h (am_nfs_fhandle): Use NFS V2/V3 file handles
+ only, not MOUNTPROC_MNT results.
+ * amd/amfs_host.c (fetch_fhandle): Use local variables to store
+ MOUNTPROC_MNT results.
+ * amd/autil.c (amfs_mount): Use new am_nfs_fhandle_t.
+ * amd/ops_nfs.c (struct fh_cache): New member fh_status.
+ (got_nfs_fh): Use local variables to store MOUNTPROC_MNT results.
+ Store MOUNTPROC_MNT errors in fh_status.
+ (prime_nfs_fhandle_cache): Get fh_error from fh_status.
+ * hlfsd/hlfsd.c (main): Use new am_nfs_fhandle_t.
+ * libamu/mount_fs.c (compute_nfs_args): Copy NFS V2/V3 file
+ handles straight from new am_nfs_fhandle_t.
+
2003-10-02 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* amd/clock.c (CID_ALLOC): Remove unused argument.
* SUCH DAMAGE.
*
*
- * $Id: amfs_host.c,v 1.23 2003/09/13 23:07:56 ib42 Exp $
+ * $Id: amfs_host.c,v 1.24 2003/10/02 16:29:28 ro Exp $
*
*/
{
struct timeval tv;
enum clnt_stat clnt_stat;
+ struct fhstatus res;
+#ifdef HAVE_FS_NFS3
+ struct mountres3 res3;
+#endif /* HAVE_FS_NFS3 */
/*
* Pick a number, any number...
plog(XLOG_INFO, "fetch_fhandle: NFS version %d", (int) nfs_version);
#ifdef HAVE_FS_NFS3
if (nfs_version == NFS_VERSION3) {
- memset((char *) &fhp->v3, 0, sizeof(fhp->v3));
+ memset((char *) &res3, 0, sizeof(res3));
clnt_stat = clnt_call(client,
MOUNTPROC_MNT,
(XDRPROC_T_TYPE) xdr_dirpath,
(SVC_IN_ARG_TYPE) &dir,
(XDRPROC_T_TYPE) xdr_mountres3,
- (SVC_IN_ARG_TYPE) &fhp->v3,
+ (SVC_IN_ARG_TYPE) &res3,
tv);
if (clnt_stat != RPC_SUCCESS) {
plog(XLOG_ERROR, "mountd rpc failed: %s", clnt_sperrno(clnt_stat));
return EIO;
}
/* Check the status of the filehandle */
- if ((errno = fhp->v3.fhs_status)) {
+ if ((errno = res3.fhs_status)) {
dlog("fhandle fetch for mount version 3 failed: %m");
return errno;
}
+ memset((voidp) &fhp->v3, 0, sizeof(am_nfs_fh3));
+ fhp->v3.fh3_length = res3.mountres3_u.mountinfo.fhandle.fhandle3_len;
+ memmove(fhp->v3.fh3_u.data,
+ res3.mountres3_u.mountinfo.fhandle.fhandle3_val,
+ fhp->v3.fh3_length);
} else { /* not NFS_VERSION3 mount */
#endif /* HAVE_FS_NFS3 */
clnt_stat = clnt_call(client,
(XDRPROC_T_TYPE) xdr_dirpath,
(SVC_IN_ARG_TYPE) &dir,
(XDRPROC_T_TYPE) xdr_fhstatus,
- (SVC_IN_ARG_TYPE) &fhp->v2,
+ (SVC_IN_ARG_TYPE) &res,
tv);
if (clnt_stat != RPC_SUCCESS) {
plog(XLOG_ERROR, "mountd rpc failed: %s", clnt_sperrno(clnt_stat));
return EIO;
}
/* Check status of filehandle */
- if (fhp->v2.fhs_status) {
- errno = fhp->v2.fhs_status;
+ if (res.fhs_status) {
+ errno = res.fhs_status;
dlog("fhandle fetch for mount version 1 failed: %m");
return errno;
}
+ memmove(&fhp->v2, &res.fhs_fh, NFS_FHSIZE);
#ifdef HAVE_FS_NFS3
} /* end of "if (nfs_version == NFS_VERSION3)" statement */
#endif /* HAVE_FS_NFS3 */
* SUCH DAMAGE.
*
*
- * $Id: autil.c,v 1.40 2003/09/20 01:09:04 ib42 Exp $
+ * $Id: autil.c,v 1.41 2003/10/02 16:29:28 ro Exp $
*
*/
#endif /* not HAVE_TRANSPORT_TYPE_TLI */
/* setup the many fields and flags within nfs_args */
- memmove(&anh.v2.fhs_fh, fhp, sizeof(*fhp));
+ memmove(&anh.v2, fhp, sizeof(*fhp));
#ifdef HAVE_TRANSPORT_TYPE_TLI
compute_nfs_args(&nfs_args,
&mnt,
* SUCH DAMAGE.
*
*
- * $Id: ops_nfs.c,v 1.32 2003/10/02 16:03:46 ro Exp $
+ * $Id: ops_nfs.c,v 1.33 2003/10/02 16:29:28 ro Exp $
*
*/
int fh_cid; /* Callout id */
u_long fh_nfs_version; /* highest NFS version on host */
am_nfs_handle_t fh_nfs_handle; /* Handle on filesystem */
+ int fh_status; /* Status of last rpc */
struct sockaddr_in fh_sin; /* Address of mountd */
fserver *fh_fs; /* Server holding filesystem */
char *fh_path; /* Filesystem on host */
got_nfs_fh(voidp pkt, int len, struct sockaddr_in *sa, struct sockaddr_in *ia, opaque_t arg, int done)
{
fh_cache *fp;
+ struct fhstatus res;
+#ifdef HAVE_FS_NFS3
+ struct mountres3 res3;
+#endif /* HAVE_FS_NFS3 */
fp = find_nfs_fhandle_cache(arg, done);
if (!fp)
* NFS protocol version.
*/
#ifdef HAVE_FS_NFS3
- if (fp->fh_nfs_version == NFS_VERSION3)
- fp->fh_error = pickup_rpc_reply(pkt, len, (voidp) &fp->fh_nfs_handle.v3,
+ if (fp->fh_nfs_version == NFS_VERSION3) {
+ memset(&res3, 0, sizeof(res3));
+ fp->fh_error = pickup_rpc_reply(pkt, len, (voidp) &res3,
(XDRPROC_T_TYPE) xdr_mountres3);
- else
+ fp->fh_status = unx_error(res3.fhs_status);
+ memset(&fp->fh_nfs_handle.v3, 0, sizeof(am_nfs_fh3));
+ fp->fh_nfs_handle.v3.fh3_length = res3.mountres3_u.mountinfo.fhandle.fhandle3_len;
+ memmove(fp->fh_nfs_handle.v3.fh3_u.data,
+ res3.mountres3_u.mountinfo.fhandle.fhandle3_val,
+ fp->fh_nfs_handle.v3.fh3_length);
+ } else {
#endif /* HAVE_FS_NFS3 */
- fp->fh_error = pickup_rpc_reply(pkt, len, (voidp) &fp->fh_nfs_handle.v2,
+ memset(&res, 0, sizeof(res));
+ fp->fh_error = pickup_rpc_reply(pkt, len, (voidp) &res,
(XDRPROC_T_TYPE) xdr_fhstatus);
+ fp->fh_status = unx_error(res.fhs_status);
+ memmove(&fp->fh_nfs_handle.v2, &res.fhs_fh, NFS_FHSIZE);
+#ifdef HAVE_FS_NFS3
+ }
+#endif /* HAVE_FS_NFS3 */
if (!fp->fh_error) {
dlog("got filehandle for %s:%s", fp->fh_fs->fs_host, fp->fh_path);
case 0:
plog(XLOG_INFO, "prime_nfs_fhandle_cache: NFS version %d", (int) fp->fh_nfs_version);
-#ifdef HAVE_FS_NFS3
- if (fp->fh_nfs_version == NFS_VERSION3)
- error = fp->fh_error = unx_error(fp->fh_nfs_handle.v3.fhs_status);
- else
-#endif /* HAVE_FS_NFS3 */
- error = fp->fh_error = unx_error(fp->fh_nfs_handle.v2.fhs_status);
+ error = fp->fh_error = fp->fh_status;
if (error == 0) {
if (mf->mf_flags & MFF_NFS_SCALEDOWN) {
* SUCH DAMAGE.
*
*
- * $Id: hlfsd.c,v 1.24 2003/07/30 06:56:13 ib42 Exp $
+ * $Id: hlfsd.c,v 1.25 2003/10/02 16:29:28 ro Exp $
*
* HLFSD was written at Columbia University Computer Science Department, by
* Erez Zadok <ezk@cs.columbia.edu> and Alexander Dupuy <dupuy@cs.columbia.edu>
if (retry <= 0)
retry = 1; /* XXX */
- memmove(&anh.v2.fhs_fh, root_fhp, sizeof(*root_fhp));
+ memmove(&anh.v2, root_fhp, sizeof(*root_fhp));
#ifdef HAVE_TRANSPORT_TYPE_TLI
compute_nfs_args(&nfs_args,
&mnt,
* SUCH DAMAGE.
*
*
- * $Id: am_utils.h,v 1.52 2003/07/30 06:56:14 ib42 Exp $
+ * $Id: am_utils.h,v 1.53 2003/10/02 16:29:29 ro Exp $
*
*/
union am_nfs_handle {
/* placeholder for V4 file handle */
#ifdef HAVE_FS_NFS3
- struct mountres3 v3; /* NFS version 3 handle */
+ am_nfs_fh3 v3; /* NFS version 3 handle */
#endif /* HAVE_FS_NFS3 */
- struct fhstatus v2; /* NFS version 2 handle */
+ am_nfs_fh v2; /* NFS version 2 handle */
};
typedef union am_nfs_handle am_nfs_handle_t;
* SUCH DAMAGE.
*
*
- * $Id: mount_fs.c,v 1.36 2003/10/01 01:47:40 ib42 Exp $
+ * $Id: mount_fs.c,v 1.37 2003/10/02 16:29:29 ro Exp $
*
*/
compute_nfs_args(nfs_args_t *nap, mntent_t *mntp, int genflags, struct netconfig *nfsncp, struct sockaddr_in *ip_addr, u_long nfs_version, char *nfs_proto, am_nfs_handle_t *fhp, char *host_name, char *fs_name)
{
int acval = 0;
-#ifdef HAVE_FS_NFS3
- static am_nfs_fh3 fh3; /* static, b/c gcc on aix corrupts stack */
-#endif /* HAVE_FS_NFS3 */
/* initialize just in case */
memset((voidp) nap, 0, sizeof(nfs_args_t));
/************************************************************************/
#ifdef HAVE_FS_NFS3
if (nfs_version == NFS_VERSION3) {
- memset((voidp) &fh3, 0, sizeof(am_nfs_fh3));
- fh3.fh3_length = fhp->v3.mountres3_u.mountinfo.fhandle.fhandle3_len;
- memmove(fh3.fh3_u.data,
- fhp->v3.mountres3_u.mountinfo.fhandle.fhandle3_val,
- fh3.fh3_length);
-
# if defined(HAVE_NFS_ARGS_T_FHSIZE) || defined(HAVE_NFS_ARGS_T_FH_LEN)
/*
* Some systems (Irix/bsdi3) have a separate field in nfs_args for
* the file handle set in nfs_args be plain bytes, and not
* include the length field.
*/
- NFS_FH_DREF(nap->NFS_FH_FIELD, &(fh3.fh3_u.data));
+ NFS_FH_DREF(nap->NFS_FH_FIELD, &fhp->v3.fh3_u.data);
# else /* not defined(HAVE_NFS_ARGS_T_FHSIZE) || defined(HAVE_NFS_ARGS_T_FH_LEN) */
- NFS_FH_DREF(nap->NFS_FH_FIELD, &fh3);
+ NFS_FH_DREF(nap->NFS_FH_FIELD, &fhp->v3);
# endif /* not defined(HAVE_NFS_ARGS_T_FHSIZE) || defined(HAVE_NFS_ARGS_T_FH_LEN) */
# ifdef MNT2_NFS_OPT_NFSV3
nap->flags |= MNT2_NFS_OPT_NFSV3;
# endif /* MNT2_NFS_OPT_VER3 */
} else
#endif /* HAVE_FS_NFS3 */
- NFS_FH_DREF(nap->NFS_FH_FIELD, &(fhp->v2.fhs_fh));
+ NFS_FH_DREF(nap->NFS_FH_FIELD, &fhp->v2);
#ifdef HAVE_NFS_ARGS_T_FHSIZE
# ifdef HAVE_FS_NFS3
if (nfs_version == NFS_VERSION3)
- nap->fhsize = fh3.fh3_length;
+ nap->fhsize = fhp->v3.fh3_length;
else
# endif /* HAVE_FS_NFS3 */
nap->fhsize = FHSIZE;