From: Dave Chinner <david@fromorbit.com>
To: Lutz Vieweg <lvml@5t9.de>
Cc: linux-fsdevel@vger.kernel.org, util-linux@vger.kernel.org,
linux-xfs@oss.sgi.com
Subject: Re: fstrim on newly created filesystem tries to discard data beyond the last sector of a device
Date: Tue, 25 Nov 2014 08:24:52 +1100 [thread overview]
Message-ID: <20141124212452.GC27262@dastard> (raw)
In-Reply-To: <m4nrjt$ghs$1@ger.gmane.org>
On Fri, Nov 21, 2014 at 06:09:17PM +0100, Lutz Vieweg wrote:
> I'm experiencing a 100% reproduceable misbehaviour of
> fstrim, which seems to put data integrity on stake:
>
> Whenever I use "fstrim" on a just newly "mkfs.xfs"ed
> filesystem on a newly installed SSD (Crucial_CT1024M550SSD1,
> firmware MU01), I get (after some activity on the device)
> this error message:
> > fitrim ioctl failed: input/output error
>
> Looking into the dmesg output reveals:
> > [1039455.530947] sd 0:0:1:0: [sdb]
> > [1039455.533192] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
> > [1039455.535369] sd 0:0:1:0: [sdb]
> > [1039455.537521] Sense Key : Illegal Request [current]
> > [1039455.539684] Info fld=0x772cdab0
> > [1039455.541802] sd 0:0:1:0: [sdb]
> > [1039455.543877] Add. Sense: Logical block address out of range
> > [1039455.545966] sd 0:0:1:0: [sdb] CDB:
> > [1039455.548008] Unmap/Read sub-channel: 42 00 00 00 00 00 00 00 18 00
> > [1039455.550080] end_request: critical target error, dev sdb, sector 1999428272
So, that's a sector well within the advertised size of the device.
> (I bought 4 of the same SSD model, and the error occurs the same with
> the other exemplars, so I can assume this is not some hardware issue.)
Oh, I wouldn't bet on it. Very likely this is a firmware bug,
because...
> I've tried the same with ext4 instead of XFS, and the very same
> error occurs, just with a slightly different sector being named
> by the dmesg error output:
> > [710565.947608] end_request: critical target error, dev sdb, sector 2000158720
Even that is supposed to be within the device range.
> Here's a list of properties of the system that might be
> relevant for the issue:
>
> According to smartctl, the capacity of this SSD is:
> > User Capacity: 1,024,209,543,168 bytes [1.02 TB]
> > Sector Sizes: 512 bytes logical, 4096 bytes physical
They make 512e SSDs now? I haven't seen one of them before. Anyway,
for a device of that size the number of logical sectors is
2000409264, which means the above errors are 500MB and 128MB from
the end of the device, respectively.
> And cat /proc/partitions tells:
> > major minor #blocks name
> > 8 16 1000204632 sdb
They are also well within the end of the device as advertised by the
kernel. This doesn't look like a filesystem or kernel issue, though
you can rull that out completely with a block trace that will show
us exactly what IO errored out...
> Do we need to fear a loss of data when using fstrim in general?
In general, from a kernel perspective, no. However, from a "does my
hardware work correctly?" perspective, we have come across lots of
devices/firmwares with broken TRIM implementations over the years.
I'd suggest you upgrade your drive to the latest firmware before
testing it again...
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
prev parent reply other threads:[~2014-11-24 21:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-10 16:07 fstrim: "fitrim ioctl failed: input/output error" -> "Logical block address out of range" Lutz Vieweg
2014-11-18 10:32 ` fstrim tries to discard data beyond the last sector of a device Lutz Vieweg
2014-11-18 11:03 ` Karel Zak
2014-11-21 16:44 ` Lutz Vieweg
2014-11-21 17:09 ` fstrim on newly created filesystem " Lutz Vieweg
2014-11-21 21:20 ` Mike Frysinger
2014-11-24 9:23 ` Karel Zak
2014-11-24 12:25 ` Lukáš Czerner
2014-11-24 19:30 ` Lutz Vieweg
2014-11-24 19:43 ` Bernd Schubert
2014-11-24 20:03 ` Lutz Vieweg
2014-11-24 20:18 ` Bernd Schubert
2014-11-24 21:24 ` Dave Chinner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141124212452.GC27262@dastard \
--to=david@fromorbit.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@oss.sgi.com \
--cc=lvml@5t9.de \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).