From owner-svn-src-head@FreeBSD.ORG Thu May 24 14:32:41 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 201AB106566B; Thu, 24 May 2012 14:32:41 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id ACB228FC08; Thu, 24 May 2012 14:32:40 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q4OEWXZ8016088; Thu, 24 May 2012 17:32:33 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q4OEWWC3065727; Thu, 24 May 2012 17:32:32 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q4OEWWIu065726; Thu, 24 May 2012 17:32:32 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 24 May 2012 17:32:32 +0300 From: Konstantin Belousov To: Alexander Motin Message-ID: <20120524143232.GM2358@deviant.kiev.zoral.com.ua> References: <201205241407.q4OE7i47042313@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3ALZ8E19BIoSIFJn" Content-Disposition: inline In-Reply-To: <201205241407.q4OE7i47042313@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r235911 - in head: share/examples/ses share/examples/ses/srcs sys/cam/scsi sys/conf sys/fs/devfs sys/modules/cam usr.bin/kdump X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2012 14:32:41 -0000 --3ALZ8E19BIoSIFJn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 24, 2012 at 02:07:44PM +0000, Alexander Motin wrote: > Author: mav > Date: Thu May 24 14:07:44 2012 > New Revision: 235911 > URL: http://svn.freebsd.org/changeset/base/235911 >=20 > Log: > MFprojects/zfsd: > Revamp the CAM enclosure services driver. > This updated driver uses an in-kernel daemon to track state changes and > publishes physical path location information\for disk elements into the > CAM device database. > =20 > Sponsored by: Spectra Logic Corporation > Sponsored by: iXsystems, Inc. > Submitted by: gibbs, will, mav >=20 > Added: > head/sys/cam/scsi/scsi_enc.c (contents, props changed) > head/sys/cam/scsi/scsi_enc.h (contents, props changed) > head/sys/cam/scsi/scsi_enc_internal.h (contents, props changed) > head/sys/cam/scsi/scsi_enc_safte.c (contents, props changed) > head/sys/cam/scsi/scsi_enc_ses.c (contents, props changed) > Deleted: > head/sys/cam/scsi/scsi_ses.c > Modified: > head/share/examples/ses/Makefile.inc > head/share/examples/ses/srcs/eltsub.c > head/share/examples/ses/srcs/getencstat.c > head/share/examples/ses/srcs/getnobj.c > head/share/examples/ses/srcs/getobjmap.c > head/share/examples/ses/srcs/getobjstat.c > head/share/examples/ses/srcs/inienc.c > head/share/examples/ses/srcs/sesd.c > head/share/examples/ses/srcs/setencstat.c > head/share/examples/ses/srcs/setobjstat.c > head/sys/cam/scsi/scsi_ses.h > head/sys/conf/files > head/sys/fs/devfs/devfs_vnops.c > head/sys/modules/cam/Makefile > head/usr.bin/kdump/mkioctls The devfs change should have been committed separately. Also, I do not see why devfs should do this to aliases at all. Also, your change only handles jails and not chroots, why ? Index: devfs_vnops.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- devfs_vnops.c (revision 235910) +++ devfs_vnops.c (revision 235911) @@ -1266,8 +1266,53 @@ static int devfs_readlink(struct vop_readlink_args *ap) { struct devfs_dirent *de; + struct cdev_priv *cdp; =20 de =3D ap->a_vp->v_data; + cdp =3D de->de_cdp; + + if (cdp !=3D NULL && (cdp->cdp_c.si_flags & SI_ALIAS) !=3D 0) { + struct devfs_mount *dmp; + struct prison *pr; + char *mp; + int mp_len; + int pr_path_len; + int err; The declarations should be placed at the start of the function, not at the start of the block. + + /* + * For device aliases, construct an absolute symlink (to + * shorten its length and avoid the ugliness of a relative + * link) by prepending the fully qualified path to the root + * of this devfs. For a non-jailed process, the devfs root + * is our mount point. For a jailed process, we must remove + * any jail prefix in our mount point so that our response + * matches the user process's world view. + */ + dmp =3D VFSTODEVFS(ap->a_vp->v_mount); + mp =3D dmp->dm_mount->mnt_stat.f_mntonname; + mp_len =3D strlen(mp); + + pr =3D ap->a_cred->cr_prison; + pr_path_len =3D strlen(pr->pr_path); + + if (strncmp(pr->pr_path, mp, pr_path_len) =3D=3D 0 + && mp[pr_path_len] =3D=3D '/') { Style prefers to put '&&' on the first line, and not on the continuation line. I suspect that you may access mp past the end of its memory there, no ? + mp +=3D pr_path_len; + mp_len -=3D pr_path_len; + } + + err =3D uiomove(mp, mp_len, ap->a_uio); + if (err !=3D 0) + return (err); + + /* + * Devfs cannot be the root file system, so its + * mount point must always be terminated by a '/'. + */ + err =3D uiomove("/", 1, ap->a_uio); + if (err !=3D 0) + return (err); + } return (uiomove(de->de_symlink, strlen(de->de_symlink), ap->a_uio)); } =20 --3ALZ8E19BIoSIFJn Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk++RoAACgkQC3+MBN1Mb4gqeQCaA6EWcqa8XjZJ1CXvzcJ5eTcC nKkAn1Spf4091kLGqz3FKcUCpSsg3krT =UtQq -----END PGP SIGNATURE----- --3ALZ8E19BIoSIFJn--