From owner-freebsd-bugs@FreeBSD.ORG Fri Mar 9 18:30:12 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2BA0A106564A for ; Fri, 9 Mar 2012 18:30:12 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id F27EC8FC0A for ; Fri, 9 Mar 2012 18:30:11 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q29IUBDs070986 for ; Fri, 9 Mar 2012 18:30:11 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q29IUBYa070984; Fri, 9 Mar 2012 18:30:11 GMT (envelope-from gnats) Resent-Date: Fri, 9 Mar 2012 18:30:11 GMT Resent-Message-Id: <201203091830.q29IUBYa070984@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Thomas Steen Rasmussen Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4FD731065670 for ; Fri, 9 Mar 2012 18:23:39 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 219D88FC0C for ; Fri, 9 Mar 2012 18:23:39 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q29INcPo007467 for ; Fri, 9 Mar 2012 18:23:38 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id q29INclh007461; Fri, 9 Mar 2012 18:23:38 GMT (envelope-from nobody) Message-Id: <201203091823.q29INclh007461@red.freebsd.org> Date: Fri, 9 Mar 2012 18:23:38 GMT From: Thomas Steen Rasmussen To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: misc/165886: Using jail name in rctl(8) doesn't work - jail id works X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Mar 2012 18:30:12 -0000 >Number: 165886 >Category: misc >Synopsis: Using jail name in rctl(8) doesn't work - jail id works >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Mar 09 18:30:11 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Thomas Steen Rasmussen >Release: FreeBSD 9.0-RELEASE amd64 >Organization: >Environment: FreeBSD osd-asrock 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Thu Mar 8 13:24:23 UTC 2012 root@osd-asrock:/usr/obj/usr/src/sys/RCTL amd64 >Description: Using jail name in rctl(8) doesn't work - jail id works. Observe: [root@osd-asrock ~]# jls JID IP Address Hostname Path 1 10.20.13.1 memtest1 /usr/jails/memtest1 2 10.20.13.2 disktest1 /usr/jails/disktest1 [root@osd-asrock ~]# rctl -hu jail:memtest1 cputime=0 datasize=0 stacksize=0 coredumpsize=0 memoryuse=0 memorylocked=0 maxproc=0 openfiles=0 vmemoryuse=0 pseudoterminals=0 swapuse=0 nthr=0 msgqqueued=0 msgqsize=0 nmsgq=0 nsem=0 nsemop=0 nshm=0 shmsize=0 wallclock=0 [root@osd-asrock ~]# rctl -hu jail:1 cputime=3 datasize=6788k stacksize=0 coredumpsize=0 memoryuse=8292k memorylocked=0 maxproc=4 openfiles=0 vmemoryuse=71M pseudoterminals=0 swapuse=0 nthr=4 msgqqueued=0 msgqsize=0 nmsgq=0 nsem=0 nsemop=0 nshm=0 shmsize=0 wallclock=1348 The problem also happens when setting the limits - if I set the limit using the jail name, the actions are not applied. >How-To-Repeat: Try using jail name in a rctl command, like this one from the rctl(8) manpage: rctl -hu jail:www Display resource usage information for jail named "www". Observe that all zeroes are returned instead of the expected values. >Fix: >From the source I am guessing the function resolve_ids() should have contained code to resolve the jail name to the jail id - but it doesn't. Adding code to resolve the jail name to id using jail_getid() in the same way jexec(8) didn't help. In fact, testing revealed that jexec(8) is also unable to resolve the jail name: # jls JID IP Address Hostname Path 1 10.20.13.1 memtest1 /usr/jails/memtest1 2 10.20.13.2 disktest1 /usr/jails/disktest1 # jexec memtest1 sh jexec: jail "memtest1" not found # So I guess this is the basic problem. These jails are installed with ezjail, if that matters. Further info and testing available on request :) >Release-Note: >Audit-Trail: >Unformatted: