linux-stable/Documentation/filesystems
Linus Torvalds 088737f44b Writeback error handling fixes (pile #2)
-----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJZXhmCAAoJEAAOaEEZVoIVpRkP/1qlYn3pq6d5Kuz84pejOmlL
 5jbkS/cOmeTxeUU4+B1xG8Lx7bAk8PfSXQOADbSJGiZd0ug95tJxplFYIGJzR/tG
 aNMHeu/BVKKhUKORGuKR9rJKtwC839L/qao+yPBo5U3mU4L73rFWX8fxFuhSJ8HR
 hvkgBu3Hx6GY59CzxJ8iJzj+B+uPSFrNweAk0+0UeWkBgTzEdiGqaXBX4cHIkq/5
 hMoCG+xnmwHKbCBsQ5js+YJT+HedZ4lvfjOqGxgElUyjJ7Bkt/IFYOp8TUiu193T
 tA4UinDjN8A7FImmIBIftrECmrAC9HIGhGZroYkMKbb8ReDR2ikE5FhKEpuAGU3a
 BXBgX2mPQuArvZWM7qeJCkxV9QJ0u/8Ykbyzo30iPrICyrzbEvIubeB/mDA034+Z
 Z0/z8C3v7826F3zP/NyaQEojUgRq30McMOIS8GMnx15HJwRsRKlzjfy9Wm4tWhl0
 t3nH1jMqAZ7068s6rfh/oCwdgGOwr5o4hW/bnlITzxbjWQUOnZIe7KBxIezZJ2rv
 OcIwd5qE8PNtpagGj5oUbnjGOTkERAgsMfvPk5tjUNt28/qUlVs2V0aeo47dlcsh
 oYr8WMOIzw98Rl7Bo70mplLrqLD6nGl0LfXOyUlT4STgLWW4ksmLVuJjWIUxcO/0
 yKWjj9wfYRQ0vSUqhsI5
 =3Z93
 -----END PGP SIGNATURE-----

Merge tag 'for-linus-v4.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux

Pull Writeback error handling updates from Jeff Layton:
 "This pile represents the bulk of the writeback error handling fixes
  that I have for this cycle. Some of the earlier patches in this pile
  may look trivial but they are prerequisites for later patches in the
  series.

  The aim of this set is to improve how we track and report writeback
  errors to userland. Most applications that care about data integrity
  will periodically call fsync/fdatasync/msync to ensure that their
  writes have made it to the backing store.

  For a very long time, we have tracked writeback errors using two flags
  in the address_space: AS_EIO and AS_ENOSPC. Those flags are set when a
  writeback error occurs (via mapping_set_error) and are cleared as a
  side-effect of filemap_check_errors (as you noted yesterday). This
  model really sucks for userland.

  Only the first task to call fsync (or msync or fdatasync) will see the
  error. Any subsequent task calling fsync on a file will get back 0
  (unless another writeback error occurs in the interim). If I have
  several tasks writing to a file and calling fsync to ensure that their
  writes got stored, then I need to have them coordinate with one
  another. That's difficult enough, but in a world of containerized
  setups that coordination may even not be possible.

  But wait...it gets worse!

  The calls to filemap_check_errors can be buried pretty far down in the
  call stack, and there are internal callers of filemap_write_and_wait
  and the like that also end up clearing those errors. Many of those
  callers ignore the error return from that function or return it to
  userland at nonsensical times (e.g. truncate() or stat()). If I get
  back -EIO on a truncate, there is no reason to think that it was
  because some previous writeback failed, and a subsequent fsync() will
  (incorrectly) return 0.

  This pile aims to do three things:

   1) ensure that when a writeback error occurs that that error will be
      reported to userland on a subsequent fsync/fdatasync/msync call,
      regardless of what internal callers are doing

   2) report writeback errors on all file descriptions that were open at
      the time that the error occurred. This is a user-visible change,
      but I think most applications are written to assume this behavior
      anyway. Those that aren't are unlikely to be hurt by it.

   3) document what filesystems should do when there is a writeback
      error. Today, there is very little consistency between them, and a
      lot of cargo-cult copying. We need to make it very clear what
      filesystems should do in this situation.

  To achieve this, the set adds a new data type (errseq_t) and then
  builds new writeback error tracking infrastructure around that. Once
  all of that is in place, we change the filesystems to use the new
  infrastructure for reporting wb errors to userland.

  Note that this is just the initial foray into cleaning up this mess.
  There is a lot of work remaining here:

   1) convert the rest of the filesystems in a similar fashion. Once the
      initial set is in, then I think most other fs' will be fairly
      simple to convert. Hopefully most of those can in via individual
      filesystem trees.

   2) convert internal waiters on writeback to use errseq_t for
      detecting errors instead of relying on the AS_* flags. I have some
      draft patches for this for ext4, but they are not quite ready for
      prime time yet.

  This was a discussion topic this year at LSF/MM too. If you're
  interested in the gory details, LWN has some good articles about this:

      https://lwn.net/Articles/718734/
      https://lwn.net/Articles/724307/"

* tag 'for-linus-v4.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux:
  btrfs: minimal conversion to errseq_t writeback error reporting on fsync
  xfs: minimal conversion to errseq_t writeback error reporting
  ext4: use errseq_t based error handling for reporting data writeback errors
  fs: convert __generic_file_fsync to use errseq_t based reporting
  block: convert to errseq_t based writeback error tracking
  dax: set errors in mapping when writeback fails
  Documentation: flesh out the section in vfs.txt on storing and reporting writeback errors
  mm: set both AS_EIO/AS_ENOSPC and errseq_t in mapping_set_error
  fs: new infrastructure for writeback error handling and reporting
  lib: add errseq_t type and infrastructure for handling it
  mm: don't TestClearPageError in __filemap_fdatawait_range
  mm: clear AS_EIO/AS_ENOSPC when writeback initiation fails
  jbd2: don't clear and reset errors after waiting on writeback
  buffer: set errors in mapping at the time that the error occurs
  fs: check for writeback errors after syncing out buffers in generic_file_fsync
  buffer: use mapping_set_error instead of setting the flag
  mm: fix mapping_set_error call in me_pagecache_dirty
2017-07-07 19:38:17 -07:00
..
caching
cifs Documentation: fix common spelling mistakes 2016-04-28 07:51:59 -06:00
configfs fs: configfs: don't return anything from drop_link 2016-12-01 10:50:49 +01:00
nfs doc: ReSTify keys-request-key.txt 2017-05-18 10:33:51 -06:00
pohmelfs Documentation: fix common spelling mistakes 2016-04-28 07:51:59 -06:00
00-INDEX logfs: remove from tree 2016-12-14 23:48:11 -05:00
9p.txt
adfs.txt
affs.txt
afs.txt rxrpc: Change module filename to rxrpc.ko 2017-02-17 15:09:19 -05:00
autofs4-mount-control.txt autofs: update ioctl documentation regarding struct autofs_dev_ioctl 2017-02-27 18:43:45 -08:00
autofs4.txt sched/wait: Rename wait_queue_t => wait_queue_entry_t 2017-06-20 12:18:27 +02:00
automount-support.txt
befs.txt
bfs.txt Tigran has moved 2017-05-12 15:57:15 -07:00
btrfs.txt Documentation: btrfs: remove usage specific information 2016-03-11 17:02:09 +01:00
ceph.txt ceph: set io_pages bdi hint 2017-02-20 12:16:05 +01:00
coda.txt
conf.py docs-rst: convert filesystems book to ReST 2017-05-16 08:44:08 -03:00
cramfs.txt mm, fs: remove remaining PAGE_CACHE_* and page_cache_{get,release} usage 2016-04-04 10:41:08 -07:00
dax.txt dax: rip out get_block based IO support 2016-11-20 20:48:36 -05:00
debugfs.txt
devpts.txt devpts: Make each mount of devpts an independent filesystem. 2016-06-05 10:36:01 -07:00
directory-locking vfs: remove unused i_op->rename 2016-09-27 11:03:58 +02:00
dlmfs.txt
dnotify.txt
ecryptfs.txt
efivarfs.txt efi: Make efivarfs entries immutable by default 2016-02-10 16:25:52 +00:00
exofs.txt
ext2.txt
ext3.txt
ext4.txt Documentation: Fix dead URLs to ftp.kernel.org 2017-03-29 15:46:06 -06:00
f2fs.txt f2fs: introduce noinline_xattr mount option 2017-02-23 10:21:48 -08:00
fiemap.txt
files.txt
fuse.txt
gfs2-glocks.txt
gfs2-uevents.txt
gfs2.txt
hfs.txt
hfsplus.txt
hpfs.txt
index.rst docs-rst: don't ignore internal functions for jbd2 docs 2017-05-16 08:44:09 -03:00
inotify.txt
isofs.txt
jfs.txt
Locking Documentation/filesystems: fix documentation for ->getattr() 2017-04-03 01:05:56 -04:00
locks.txt docs: fix locations of several documents that got moved 2016-10-24 08:12:35 -02:00
mandatory-locking.txt
ncpfs.txt
nilfs2.txt nilfs2: move ioctl interface and disk layout to uapi separately 2016-08-02 19:35:21 -04:00
ntfs.txt
ocfs2-online-filecheck.txt Doc: ocfs: Fix typo in filesystems/ocfs2-online-filecheck.txt 2016-07-01 16:17:15 -06:00
ocfs2.txt
omfs.txt
orangefs.txt Orangefs: update orangefs.txt 2016-08-02 15:39:14 -04:00
overlayfs.txt ovl: update documentation w.r.t. constant inode numbers 2017-05-05 11:38:59 +02:00
path-lookup.md
path-lookup.txt
porting Documentation/filesystems: fix documentation for ->getattr() 2017-04-03 01:05:56 -04:00
proc.txt proc: show MADV_FREE pages info in smaps 2017-05-03 15:52:08 -07:00
qnx6.txt Documentation: fix common spelling mistakes 2016-04-28 07:51:59 -06:00
quota.txt scripts/spelling.txt: add "an user" pattern and fix typo instances 2017-02-27 18:43:46 -08:00
ramfs-rootfs-initramfs.txt
relay.txt
romfs.txt
seq_file.txt
sharedsubtree.txt doc: fix grammar 2016-03-09 15:33:06 -07:00
spufs.txt
squashfs.txt
sysfs-pci.txt PCI: Add pci_mmap_resource_range() and use it for ARM64 2017-04-20 08:47:47 -05:00
sysfs-tagging.txt
sysfs.txt
sysv-fs.txt
tmpfs.txt Documenation: update cgroup's document path 2016-08-03 15:43:58 -06:00
ubifs.txt
udf.txt
ufs.txt
vfat.txt fat: add config option to set UTF-8 mount option by default 2016-03-22 15:36:02 -07:00
vfs.txt Documentation: flesh out the section in vfs.txt on storing and reporting writeback errors 2017-07-06 07:02:27 -04:00
xfs-delayed-logging-design.txt
xfs-self-describing-metadata.txt
xfs.txt xfs: deprecate barrier/nobarrier mount option 2016-12-09 16:49:54 +11:00