From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754052AbcBXCI3 (ORCPT ); Tue, 23 Feb 2016 21:08:29 -0500 Received: from mailout.micron.com ([137.201.242.129]:23375 "EHLO mailout.micron.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751679AbcBXCI1 (ORCPT ); Tue, 23 Feb 2016 21:08:27 -0500 Subject: Re: [PATCH 01/10] mtip32xx: Abort secure erase when drive is mounted To: Jens Axboe References: <20160223161104.GA13712@kernel.dk> CC: , Sam Bradshaw , Selvan Mani , Rajesh Kumar Sambandam , Vignesh Gunasekaran From: Asai Thambi SP Message-ID: <1d4ce067-9116-c2b1-f1d8-27c4f862cc5c@micron.com> Date: Tue, 23 Feb 2016 18:08:25 -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: <20160223161104.GA13712@kernel.dk> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-TM-AS-Product-Ver: SMEX-11.0.0.4255-8.000.1202-22150.001 X-TM-AS-Result: No--8.725900-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 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.