From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755318AbcBXCi6 (ORCPT ); Tue, 23 Feb 2016 21:38:58 -0500 Received: from mailout.micron.com ([137.201.242.129]:35772 "EHLO mailout.micron.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755206AbcBXCi4 (ORCPT ); Tue, 23 Feb 2016 21:38:56 -0500 Subject: Re: [PATCH 01/10] mtip32xx: Abort secure erase when drive is mounted To: Jens Axboe References: <20160223161104.GA13712@kernel.dk> <1d4ce067-9116-c2b1-f1d8-27c4f862cc5c@micron.com> <56CD11F4.4090503@kernel.dk> CC: , Sam Bradshaw , Selvan Mani , Rajesh Kumar Sambandam , Vignesh Gunasekaran From: Asai Thambi SP Message-ID: Date: Tue, 23 Feb 2016 18:38:53 -0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <56CD11F4.4090503@kernel.dk> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.000.1202-22150.001 X-TM-AS-Result: No--10.046700-0.000000-31 X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-MT-CheckInternalSenderRule: True Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/23/2016 6:14 PM, Jens Axboe wrote: > 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... Agreed. I will drop this patch and resend the rest.