From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754737Ab0CDSXn (ORCPT ); Thu, 4 Mar 2010 13:23:43 -0500 Received: from mail-vw0-f46.google.com ([209.85.212.46]:41175 "EHLO mail-vw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754500Ab0CDSXl convert rfc822-to-8bit (ORCPT ); Thu, 4 Mar 2010 13:23:41 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=CWtLJdkcvTcLMWsGessX8seZO17wmNcjUgiebttkZWx1SjsMS81iVS5vVfQ35cBM/Y xSPad0H+mDLq0lmqqf3L5LxH9LfrPf4tstQeMSmwRNJ+ZPLt6Ve1AEzcS78PCAMl+oTs yUCwei76YpiDS6jkSkPFUizCTREfLJ+x9zchs= MIME-Version: 1.0 In-Reply-To: <201003041637.o24GbtJX005739@alien.loup.net> References: <20100303224245.ae8d1f7a.akpm@linux-foundation.org> <201003041637.o24GbtJX005739@alien.loup.net> Date: Thu, 4 Mar 2010 13:23:40 -0500 Message-ID: Subject: Re: Linux kernel - Libata bad block error handling to user mode program From: s ponnusa To: Mike Hayward Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org, jens.axboe@oracle.com, linux-mm@kvack.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I have used O_DIRECT with aligned buffers of 4k size (the default linux page size). I have even tried fadvise calls according to Linus's suggestion of not using the O_DIRECT method. None of the above method causes the write call to fail and media errors to be propagated to my program. It is handled at the driver / kernel level (either by retrying / remapping the sector). Please advise. Thanks. On Thu, Mar 4, 2010 at 11:37 AM, Mike Hayward wrote: > I always take it for granted, but forgot to mention, you should also > use O_DIRECT to bypass the linux buffer cache.  It often gets in the > way of error propagation since it is changing your io requests into > it's own page sized ios and will also "lie" to you about having > written your data in the first place since it's a write back cache. > > The point is you have to disable all the caches everywhere or the > error information will get absorbed by the caches. > > - Mike >