From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1GXtzT-0007Uq-3C for garchives@archives.gentoo.org; Thu, 12 Oct 2006 06:24:23 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.8/8.13.6) with SMTP id k9C6JoCU010917; Thu, 12 Oct 2006 06:19:50 GMT Received: from ms-smtp-03.texas.rr.com (ms-smtp-03.texas.rr.com [24.93.47.42]) by robin.gentoo.org (8.13.8/8.13.6) with ESMTP id k9C6HXbw001862 for ; Thu, 12 Oct 2006 06:17:34 GMT Received: from [192.168.1.100] (cpe-68-201-116-137.gt.res.rr.com [68.201.116.137]) by ms-smtp-03.texas.rr.com (8.13.6/8.13.6) with ESMTP id k9C6HVMn011017 for ; Thu, 12 Oct 2006 01:17:32 -0500 (CDT) Message-ID: <452DDDFB.6020702@gt.rr.com> Date: Thu, 12 Oct 2006 01:17:31 -0500 From: "Anthony E. Caudel" User-Agent: Thunderbird 1.5.0.7 (X11/20060926) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Dumb question References: <452C714D.2030008@gt.rr.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Symantec AntiVirus Scan Engine X-Archives-Salt: 03987e2e-4d62-413c-b298-25c261052e70 X-Archives-Hash: 0524a8001d1d73bf255a3be6237ca3eb Daniel Barkalow wrote: > On Tue, 10 Oct 2006, Anthony E. Caudel wrote: > >> I have been using Gentoo for more than 2 years now and have always >> wondered (but never asked - That's the "dumb" part) how Gentoo manages >> to update a package that happens to be running at the time. >> >> Given that the old version (the one running) is deleted, how does it >> manage to keep standing if you just cut its legs off? > > Userspace technically never "deletes" anything in the UNIX model; it > either "truncates" it (not what's going on here) or it "unlinks" it. > "Unlink" causes the file not to have the filename any more, and the kernel > gets rid of files which aren't in use and have no name (of course, nobody > can tell when or if this happens, aside from the disk not filling up, > because there would be no way to look at the file anyway). > > If you look at /proc//maps for a program you've upgraded, you'll > probably find funny notations in there, indicating that the file it's > using is not the file that currently has that filename. > > ("truncate" and otherwise openning the file for writing actually affect > the file, not the filename, and would therefore cause programs to crash if > you overwrote them.) > > Technical terms: the file itself is called an "inode", and the name is a > "dentry" (actually, the last part of the path, which is all that goes away > in a single operation, is the dentry). A dentry stores the inode number of > the inode at that path, and "unlink" removes the dentry. What's actually > happening in an upgrade is "rename", which, as a single operation, unlinks > any dentry with the destination path, links the source inode to the > destination dentry, and unlinks the source dentry. This means that no > program can see the path empty or with half of a file or see the file with > two names. > > -Daniel > *This .sig left intentionally blank* Thanks all. I guess I now understand how it works. Someone noted that if you update sshd for example, a restart would be in order afterward. This would seem to be true of a lot of programs. So would a total restart of the system (just short of a reboot) be warranted? Tony -- Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety. -- Benjamin Franklin -- gentoo-user@gentoo.org mailing list