1. 15 Apr, 2015 5 commits
    • David Howells's avatar
      VFS: Combine inode checks with d_is_negative() and d_is_positive() in pathwalk · 698934df
      David Howells authored
      Where we have:
      
          	if (!dentry->d_inode || d_is_negative(dentry)) {
      
      type constructions in pathwalk we should be able to eliminate the check of
      d_inode and rely solely on the result of d_is_negative() or d_is_positive().
      
      What we do have to take care to do is to read d_inode after calling a
      d_is_xxx() typecheck function to get the barriering right.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      698934df
    • David Howells's avatar
      NFS: Don't use d_inode as a variable name · 88e7fbd4
      David Howells authored
      Don't use d_inode as a variable name as it now masks a function name.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      88e7fbd4
    • David Howells's avatar
      VFS: Impose ordering on accesses of d_inode and d_flags · 4bf46a27
      David Howells authored
      Impose ordering on accesses of d_inode and d_flags to avoid the need to do
      this:
      
      	if (!dentry->d_inode || d_is_negative(dentry)) {
      
      when this:
      
      	if (d_is_negative(dentry)) {
      
      should suffice.
      
      This check is especially problematic if a dentry can have its type field set
      to something other than DENTRY_MISS_TYPE when d_inode is NULL (as in
      unionmount).
      
      What we really need to do is stick a write barrier between setting d_inode and
      setting d_flags and a read barrier between reading d_flags and reading
      d_inode.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      4bf46a27
    • David Howells's avatar
      VFS: Add owner-filesystem positive/negative dentry checks · 525d27b2
      David Howells authored
      Supply two functions to test whether a filesystem's own dentries are positive
      or negative (d_really_is_positive() and d_really_is_negative()).
      
      The problem is that the DCACHE_ENTRY_TYPE field of dentry->d_flags may be
      overridden by the union part of a layered filesystem and isn't thus
      necessarily indicative of the type of dentry.
      
      Normally, this would involve a negative dentry (ie. ->d_inode == NULL) having
      ->d_layer.lower pointed to a lower layer dentry, DCACHE_PINNING_LOWER set and
      the DCACHE_ENTRY_TYPE field set to something other than DCACHE_MISS_TYPE - but
      it could also involve, say, a DCACHE_SPECIAL_TYPE being overridden to
      DCACHE_WHITEOUT_TYPE if a 0,0 chardev is detected in the top layer.
      
      However, inside a filesystem, when that fs is looking at its own dentries, it
      probably wants to know if they are really negative or not - and doesn't care
      about the fallthrough bits used by the union.
      
      To this end, a filesystem should normally use d_really_is_positive/negative()
      when looking at its own dentries rather than d_is_positive/negative() and
      should use d_inode() to get at the inode.
      
      Anyone looking at someone else's dentries (this includes pathwalk) should use
      d_is_xxx() and d_backing_inode().
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      525d27b2
    • Al Viro's avatar
      65a4a1ca
  2. 12 Apr, 2015 35 commits