Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032890AbbKEIGr (ORCPT ); Thu, 5 Nov 2015 03:06:47 -0500 Received: from mx2.suse.de ([195.135.220.15]:60252 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1032099AbbKEIGq (ORCPT ); Thu, 5 Nov 2015 03:06:46 -0500 Date: Thu, 5 Nov 2015 09:06:42 +0100 From: Jan Kara To: "Elliott, Robert (Persistent Memory)" Cc: Jan Kara , "axboe@kernel.dk" , LKML , "linux-fsdevel@vger.kernel.org" , Christoph Hellwig Subject: Re: [PATCH] brd: Refuse improperly aligned discard requests Message-ID: <20151105080642.GD20212@quack.suse.cz> References: <1446653619-22880-1-git-send-email-jack@suse.com> <94D0CD8314A33A4D9D801C0FE68B40295BE0AFAA@G4W3202.americas.hpqcorp.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <94D0CD8314A33A4D9D801C0FE68B40295BE0AFAA@G4W3202.americas.hpqcorp.net> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1665 Lines: 37 On Thu 05-11-15 04:18:49, Elliott, Robert (Persistent Memory) wrote: > > > -----Original Message----- > > From: linux-kernel-owner@vger.kernel.org [mailto:linux-kernel- > > owner@vger.kernel.org] On Behalf Of Jan Kara > > Sent: Wednesday, November 4, 2015 10:14 AM > > To: axboe@kernel.dk > > Cc: LKML ; linux-fsdevel@vger.kernel.org; > > Christoph Hellwig ; Jan Kara > > Subject: [PATCH] brd: Refuse improperly aligned discard requests > > > > Currently when improperly aligned discard request is submitted, we just > > silently discard more / less data which results in filesystem corruption > > in some cases. Refuse such misaligned requests. > > I agree discarding more than requested is very bad. > > If they are routed to SCSI or ATA devices, though, the discard commands > (SCSI UNMAP or ATA DATA SET MANAGEMENT/TRIM) are just hints, so there > is no guarantee the discard will do anything. Are you finding > filesystems that still don't understand that? dm-raid held that > mistaken assumption for a long time. So there is blkdev_issue_zeroout() which uses blkdev_issue_discard() if 'discard_zeroes_data' is set. I'd hope that in that case zeroing really happens as submitted or error is returned... Filesystems definitely depend on blkdev_issue_zeroout() doing what it is told. Honza -- Jan Kara SUSE Labs, CR -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/