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.