linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHES][RFC] icache-related stuff
@ 2018-07-29 22:03 Al Viro
  2018-07-29 22:04 ` [PATCH 01/16] nfs_instantiate(): prevent multiple aliases for directory inode Al Viro
                   ` (2 more replies)
  0 siblings, 3 replies; 30+ messages in thread
From: Al Viro @ 2018-07-29 22:03 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Linus Torvalds, linux-kernel, Miklos Szeredi

Assorted icache-related fixes for the next window; some of that is -stable
fodder.

1) NFS and FUSE mkdir/open_by_handle() race fix.  NFS side posted and
discussed earlier, NFS folks hadn't objected...  Basically, the strategy
used by local filesystems to deal with that kind of races does not (and
cannot) work for NFS - there the icache search key is not even known to us
until the underlying (== server-side) data structures for the object being
created look good.  So we need a different approach - just let nfs_mkdir()
use d_splice_alias() and leave the originally passed dentry unhashed
negative if we'd raced and picked an existing alias.  The callers of
->mkdir() are fine with that.   Unlike NFS, FUSE (which has the same kind
of problem) does deal with it in mainline.  However, the same approach
(d_splice_alias() and leave the argument unhashed negative if aliases
exist) works better than what FUSE does in mainline *and* allows to kill
a warty primitive nobody else is using.

      nfs_instantiate(): prevent multiple aliases for directory inode
      kill d_instantiate_no_diralias()

2) The local side of things isn't exactly correct either - typical local
fh_to_dentry() will do icache lookup and if setup fails halfway through
e.g. mkdir(), we are left with a nasty choice - either we leave the
not-quite-set-up inode hashed (and then open_by_handle() can pick it,
with subsequent nasal demons) or we unhash it and risk open_by_handle()
coming immediately after unhash and getting a separate in-core inode
for the same on-disk one, just as the on-disk one gets freed.  Some
filesystems are careful enough with those half-set-up inodes to be
safe (with the first variant, that is).  Some are not.

        Solution: new flag (I_CREATING) set by insert_inode_locked() and
removed by unlock_new_inode() and a new primitive (discard_new_inode())
to be used by such halfway-through-setup failure exits instead of
unlock_new_inode() / iput() combinations.  That primitive unlocks new
inode, but leaves I_CREATING in place.

        iget_locked() treats finding an I_CREATING inode as failure
(-ESTALE, once we sort out the error propagation).
        insert_inode_locked() treats the same as instant -EBUSY.
        ilookup() treats those as icache miss.

A bunch of filesystems switched to discard_new_inode() (btrfs, ufs, udf, ext2,
jfs)
      new primitive: discard_new_inode()
      btrfs: switch to discard_new_inode()
      ufs: switch to discard_new_inode()
      udf: switch to discard_new_inode()
      ext2: make sure that partially set up inodes won't be returned by ext2_iget()
      jfs: switch to discard_new_inode()

3) Miklos' regression fix (he had been too optimistic in iget5_locked cleanups
this window; I'd grumbled about that being wrong, but hadn't realized how
bad it was).
      vfs: don't evict uninitialized inode

4) several btrfs cleanups around btrfs_iget() and friends.
      btrfs: btrfs_iget() never returns an is_bad_inode() inode.
      btrfs: IS_ERR(p) && PTR_ERR(p) == n is a weird way to spell p == ERR_PTR(n)
      btrfs: lift make_bad_inode() into btrfs_iget()
      btrfs: simplify btrfs_iget()

5) misc stuff - new primitive for filesystems that want inodes to look hashed,
but don't want them polluting the hash chains (currently open-coded), making
adfs use that (it never ever looks anything in icache), dropping a cargo-culted
make_bad_inode() in jfs ialloc failure path.
      new helper: inode_fake_hash()
      adfs: don't put inodes into icache
      jfs: don't bother with make_bad_inode() in ialloc()

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2018-10-08 13:23 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-29 22:03 [PATCHES][RFC] icache-related stuff Al Viro
2018-07-29 22:04 ` [PATCH 01/16] nfs_instantiate(): prevent multiple aliases for directory inode Al Viro
2018-07-29 22:04   ` [PATCH 02/16] new primitive: discard_new_inode() Al Viro
2018-07-29 22:04   ` [PATCH 03/16] vfs: don't evict uninitialized inode Al Viro
2018-07-30  5:09     ` Amir Goldstein
2018-07-30  7:41       ` Miklos Szeredi
2018-08-16 16:29         ` Amir Goldstein
2018-08-24  6:47           ` Amir Goldstein
2018-10-08  6:41             ` Miklos Szeredi
2018-10-08 13:23               ` Greg KH
2018-07-29 22:04   ` [PATCH 04/16] btrfs: switch to discard_new_inode() Al Viro
2018-08-01 15:25     ` David Sterba
2018-07-29 22:04   ` [PATCH 05/16] ufs: " Al Viro
2018-07-29 22:04   ` [PATCH 06/16] udf: " Al Viro
2018-07-29 22:04   ` [PATCH 07/16] ext2: make sure that partially set up inodes won't be returned by ext2_iget() Al Viro
2018-07-29 22:04   ` [PATCH 08/16] btrfs: btrfs_iget() never returns an is_bad_inode() inode Al Viro
2018-07-30  8:13     ` Nikolay Borisov
2018-07-29 22:04   ` [PATCH 09/16] btrfs: IS_ERR(p) && PTR_ERR(p) == n is a weird way to spell p == ERR_PTR(n) Al Viro
2018-07-30  8:06     ` Nikolay Borisov
2018-07-29 22:04   ` [PATCH 10/16] kill d_instantiate_no_diralias() Al Viro
2018-07-29 22:04   ` [PATCH 11/16] jfs: switch to discard_new_inode() Al Viro
2018-07-29 22:04   ` [PATCH 12/16] new helper: inode_fake_hash() Al Viro
2018-07-29 22:04   ` [PATCH 13/16] btrfs: lift make_bad_inode() into btrfs_iget() Al Viro
2018-07-30  8:15     ` Nikolay Borisov
2018-07-29 22:04   ` [PATCH 14/16] btrfs: simplify btrfs_iget() Al Viro
2018-07-30  8:17     ` Nikolay Borisov
2018-07-29 22:04   ` [PATCH 15/16] adfs: don't put inodes into icache Al Viro
2018-07-29 22:04   ` [PATCH 16/16] jfs: don't bother with make_bad_inode() in ialloc() Al Viro
2018-07-30 21:35 ` [PATCHES][RFC] icache-related stuff Linus Torvalds
2018-08-01 15:25 ` David Sterba

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).