From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754359AbcBXCOQ (ORCPT ); Tue, 23 Feb 2016 21:14:16 -0500 Received: from mail-pf0-f172.google.com ([209.85.192.172]:34488 "EHLO mail-pf0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751405AbcBXCOO (ORCPT ); Tue, 23 Feb 2016 21:14:14 -0500 Subject: Re: [PATCH 01/10] mtip32xx: Abort secure erase when drive is mounted To: Asai Thambi SP References: <20160223161104.GA13712@kernel.dk> <1d4ce067-9116-c2b1-f1d8-27c4f862cc5c@micron.com> Cc: linux-kernel@vger.kernel.org, Sam Bradshaw , Selvan Mani , Rajesh Kumar Sambandam , Vignesh Gunasekaran From: Jens Axboe Message-ID: <56CD11F4.4090503@kernel.dk> Date: Tue, 23 Feb 2016 19:14:12 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1d4ce067-9116-c2b1-f1d8-27c4f862cc5c@micron.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/23/2016 07:08 PM, Asai Thambi SP wrote: > On 2/23/2016 8:11 AM, Jens Axboe wrote: >> On Mon, Feb 22 2016, Asai Thambi SP wrote: >>> >>> To avoid erasing a device with a mounted filesystem, try to get exclusive >>> access to the blkdev object corresponding to the device. >> >> I don't think this needs to be in the kernel, why not just check from >> the official format tool if the device is mounted or not? >> > > The official format tool checks if the device has a mounted filesystem before starting an erase operation. But with the driver being in kernel, some customers use hdparm to manage the device. This patch prevents possible accidental erase through open source tools. We generally don't put that kind of policy in the kernel. I can firmware update a drive that is mounted, if I want to shoot myself in the foot, if I want to. The answer is, don't do it... -- Jens Axboe