Re: Questions about filesystems from SQLite author presentation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 6 Jan 2020 at 16:42, Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
>
> On Mon, Jan 06, 2020 at 05:40:20PM +0200, Amir Goldstein wrote:
> > On Mon, Jan 6, 2020 at 9:26 AM Sitsofe Wheeler <sitsofe@xxxxxxxxx> wrote:
> > > If a write occurs on one or two bytes of a file at about the same time as a power
> > > loss, are other bytes of the file guaranteed to be unchanged after reboot?
> > > Or might some other bytes within the same sector have been modified as well?
> >
> > I don't see how other bytes could change in this scenario, but I don't
> > know if the
> > hardware provides this guarantee. Maybe someone else knows the answer.
>
> The question is nonsense because there is no way to write less than one
> sector to a hardware device, by definition.  So, treating this question
> as being a read-modify-write of a single sector (assuming the "two bytes"
> don't cross a sector boundary):
>
> Hardware vendors are reluctant to provide this guarantee, but it's
> essential to constructing a reliable storage system.  We wrote the NVMe
> spec in such a way that vendors must provide single-sector-atomicity
> guarantees, and I hope they haven't managed to wiggle some nonsense
> into the spec that allows them to not make that guarantee.  The below
> is a quote from the 1.4 spec.  For those not versed in NVMe spec-ese,
> "0's based value" means that putting a zero in this field means the
> value of AWUPF is 1.

Wow - that's the first time I've seen someone go on the record as
saying a sector write is atomic (albeit only for NVMe disks) without
having it instantly debated! Sadly there's no way of guaranteeing this
atomicity from userspace if https://youtu.be/-oP2BOsMpdo?t=3557 (where
Chris Mason(?) warns there can be corner cases trying to use O_DIRECT)
is to be believed though?

> I take neither blame nor credit for what other storage standards may
> implement; this is the only one I had a hand in, and I had to fight
> hard to get it.

So there's no consensus for SATA/SCSI etc
(https://stackoverflow.com/questions/2009063/are-disk-sector-writes-atomic
)? Just need to wait until there's NVMe everywhere :-)

-- 
Sitsofe | http://sucs.org/~sits/



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux