1. 24 1月, 2018 4 次提交
    • A
      ovl: encode non-indexed upper file handles · b305e844
      Amir Goldstein 提交于
      We only need to encode origin if there is a chance that the same object was
      encoded pre copy up and then we need to stay consistent with the same
      encoding also after copy up.
      
      In case a non-pure upper is not indexed, then it was copied up before NFS
      export support was enabled. In that case, we don't need to worry about
      staying consistent with pre copy up encoding and we encode an upper file
      handle.
      
      This mitigates the problem that with no index, we cannot find an upper
      inode from origin inode, so we cannot decode a non-indexed upper from
      origin file handle.
      Signed-off-by: NAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      b305e844
    • A
      ovl: decode connected upper dir file handles · 3985b70a
      Amir Goldstein 提交于
      Until this change, we decoded upper file handles by instantiating an
      overlay dentry from the real upper dentry. This is sufficient to handle
      pure upper files, but insufficient to handle merge/impure dirs.
      
      To that end, if decoded real upper dir is connected and hashed, we
      lookup an overlay dentry with the same path as the real upper dir.
      If decoded real upper is non-dir, we instantiate a disconnected overlay
      dentry as before this change.
      
      Because ovl_fh_to_dentry() returns a connected overlay dir dentry,
      exportfs never needs to call get_parent() and get_name() to reconnect an
      upper overlay dir. Because connectable non-dir file handles are not
      supported, exportfs will not be able to use fh_to_parent() and get_name()
      methods to reconnect a disconnected non-dir to its parent. Therefore, the
      methods get_parent() and get_name() are implemented just to print out a
      sanity warning and the method fh_to_parent() is implemented to warn the
      user that using the 'subtree_check' exportfs option is not supported.
      
      An alternative approach could have been to implement instantiating of
      an overlay directory inode from origin/index and implement get_parent()
      and get_name() by calling into underlying fs operations and them
      instantiating the overlay parent dir.
      
      The reasons for not choosing the get_parent() approach were:
      - Obtaining a disconnected overlay dir dentry would requires a
        delicate re-factoring of ovl_lookup() to get a dentry with overlay
        parent info. It was preferred to avoid doing that re-factoring unless
        it was proven worthy.
      - Going down the path of disconnected dir would mean that the (non
        trivial) code path of d_splice_alias() could be traveled and that
        meant writing more tests and introduces race cases that are very hard
        to hit on purpose. Taking the path of connecting overlay dentry by
        forward lookup is therefore the safe and boring way to avoid surprises.
      
      The culprits of the chosen "connected overlay dentry" approach:
      - We need to take special care to rename of ancestors while connecting
        the overlay dentry by real dentry path. These subtleties are usually
        handled by generic exportfs and VFS code.
      - In a hypothetical workload, we could end up in a loop trying to connect,
        interrupted by rename and restarting connect forever.
      Signed-off-by: NAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      3985b70a
    • A
      ovl: decode pure upper file handles · 8556a420
      Amir Goldstein 提交于
      Decoding an upper file handle is done by decoding the upper dentry from
      underlying upper fs, finding or allocating an overlay inode that is
      hashed by the real upper inode and instantiating an overlay dentry with
      that inode.
      Signed-off-by: NAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      8556a420
    • A
      ovl: encode pure upper file handles · 8ed5eec9
      Amir Goldstein 提交于
      Encode overlay file handles as struct ovl_fh containing the file handle
      encoding of the real upper inode.
      Signed-off-by: NAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      8ed5eec9