From owner-freebsd-questions@FreeBSD.ORG Fri Mar 9 21:52:59 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 357A216A401 for ; Fri, 9 Mar 2007 21:52:59 +0000 (UTC) (envelope-from modulok@gmail.com) Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.232]) by mx1.freebsd.org (Postfix) with ESMTP id E59AC13C428 for ; Fri, 9 Mar 2007 21:52:58 +0000 (UTC) (envelope-from modulok@gmail.com) Received: by wx-out-0506.google.com with SMTP id s18so922727wxc for ; Fri, 09 Mar 2007 13:52:58 -0800 (PST) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=jpFoE7tN1IR0se+xzm8C4FADhB78mWWIma2gTG8m5rBZgitQh4eU4lSgPwgf+Ojbpxcg7+Oqjg/UvzWfHmm/KSUisoXUya7U/Oq0ZNKiViDedqOu04dIowJS3Sl14V28GQMTHn6ovZJitY8wfTucAyOiEofDwlc0DyNitx1IkhM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=gazUiQ3vqsEqqnZetLGlcjEE/p6Ns3H5egq/sP9TLAMGr+IRxPP1NhKSa509RT10jTbf4okUU+jIXAOodB+syEV+p1mVZes4AEFAdIVK3WMhBdQVaLe4V/15nhwTRvZYmFFHZxveZ7zJaGqWWTCXxmbkw5t5ZYXg9vj95AyltSo= Received: by 10.70.77.2 with SMTP id z2mr3796676wxa.1173477177909; Fri, 09 Mar 2007 13:52:57 -0800 (PST) Received: by 10.100.198.6 with HTTP; Fri, 9 Mar 2007 13:52:57 -0800 (PST) Message-ID: <64c038660703091352u7d8e498eq8049b78a34933555@mail.gmail.com> Date: Fri, 9 Mar 2007 14:52:57 -0700 From: Modulok To: "Nikos Vassiliadis" In-Reply-To: <200703091608.47529.nvass@teledomenet.gr> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <64c038660703080349t3311fa22lf8e6ba736db330ed@mail.gmail.com> <200703091139.51272.nvass@teledomenet.gr> <64c038660703090528k6974a8c3odf87e4d8a3b368c9@mail.gmail.com> <200703091608.47529.nvass@teledomenet.gr> Cc: freebsd-questions@freebsd.org Subject: Re: Kill a hanged disk i/o process... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Mar 2007 21:52:59 -0000 ...alright then... "How do I work-around a situation where cp, hangs forever?" -Modulok- On 3/9/07, Nikos Vassiliadis wrote: > On Friday 09 March 2007 15:28, Modulok wrote: > > Thank you for your reply, it was quite informative and very much > > appreciated, but the underlying question remains un-answered: > > > > How do you kill a hanged process that (seemingly) cannot be killed because > > of the two conditions below? > > > > -It's hanged, so it's not ever going to self terminate. > > -It's a disk i/o process so not even root can kill it. > > > > As I said before disk I/O is irrelevant. > > > The gentle shutdown solution doesn't work: Even during shutdown the > process > > cannot be killed: it's hanged, it's disk i/o. > > > > How do you kill an un-killable process? > > What makes you believe there is another official way > to kill a process? > > Perhaps you should ask "How do I work-around a situation > where my rm, cp, whatever hang forever?", if that's what > you are looking for. > > > -Modulok- > > > > > > On 3/9/07, Nikos Vassiliadis wrote: > > > > > > On Thursday 08 March 2007 13:49, Modulok wrote: > > > > To the best of my knowledge, most processes can be killed explicitly > > > > by "kill -s KILL;" There are a few which cannot, such as disk i/o > > > > processes. The idea here is data integrity. > > > > > > A process might be in cannot-be-killed condition while > > > in kernel e.g. during a system call. That has to do with > > > the completion of the system call, not with data integrity. > > > The kernel tries to complete what was asked for. > > > > > > Also, Killing a process with SIGKILL is far from safe. To put > > > it in another way "data integrity" can be guaranteed only > > > by the program itself. For example it could have a defined > > > behavior when it is signaled by e.g. SIGTERM, for example > > > clean up data and exit. Or not. It's up to the programmer. > > > Sending a SIGKILL will not give that chance. SIGKILL can > > > not be handled. It will be terminated as soon as possible. > > > > > > Also, separate the meanings "data integrity" and "filesystem > > > data integrity". The filesystem will be in fine condition when > > > a process gets killed by SIGKILL during file I/O, the data in > > > the file most probably not. > > > > > > > > > > > On the rare occasion however, (when attempting to recover data from > > > > corrupt disks for example), I've had a process invoked by the "cp" > > > > command, hang. This poses a significant problem as these processes are > > > > disk i/o processes, and as such cannot be terminated (even by root). > > > > So, other than physically hitting the reset button on the case, is > > > > there a more eloquent method of forcefully halting a hanged disk i/o > > > > process? The idea of "you don't want to terminate a disk i/o process, > > > > it could corrupt the data" isn't really a good argument, because if > > > > the process hangs and I have to punch the reset button anyway what's > > > > the difference? > > > > > > "Pressing the button" will leave your filesystem in a undefined state, > > > you are risking filesystem integrity. Keep in mind that while in use > > > (open files etc) a filesystem cannot be unmounted. Anyway, try to shut > > > the computer down, it's far more gentle than pressing the button. At > > > least the rest of the filesystems will be cleanly unmounted. > > > > > > Is there something in particular you want to achieve? > > > > > > Nikos > > > > > >