rgw: send user manifest header field

Fixes: #8170
Backport: firefly
If user manifest header exists (swift) send it as part of the object
header data.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: cut short object read if a chunk returns error

Fixes: #8289
Backport: firefly, dumpling
When reading an object, if we hit an error when trying to read one of
the rados objects then we should just stop. Otherwise we're just going
to continue reading the rest of the object, and since it can't be sent
back to the client (as we have a hole in the middle), we end up
accumulating everything in memory.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
ceph-disk: fix list for encrypted or corrupt volume

Continue gracefully if an fs type is not detected, either because it is
encrypted or because it is corrupted.

Signed-off-by: Sage Weil <sage@inktank.com>
mds: maintain auth bits during replay

Objects' STATE_AUTH bits are set when replaying EImportStart event.
MDCache::trim_non_auth_subtree() clear objects' STATE_AUTH bits when
replaying EExport event.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: send dentry unlink message to replicas of stray dentry

stray dentry may have more replicas than the unlinked dentry has.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: include authpinned objects in remote authpin request

Server::handle_slave_auth_pin() may drop old authpins if it encounters
object that is not authpinable. So it is better to include objects that
have already been authpinned in the remote authpin reuqest.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: fix frozen inode check in MDCache::handle_discover()

When MDCache::handle_discover() encounters a frozen dirfrag, it should
proceed if the dirfrag is being merged, but the MDS hasn't frozen all
dirfrags yet. When MDCache::handle_discover() checks if a inode is
frozen, it should use CInode::is_frozen_inode() (which doesn't check if
inode's parent dirfrag is frozen).

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: pre-allocate inode numbers less frequently

no need to refill the pre-allocated inode numbers each time an inode
number is used.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: tolerate bad sessionmap during journal replay

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: remove mdsdir in the final step of shutdown MDS

Otherwise we may get bad subtree map if we restart the MDS before
the shutdown process finishes.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: clear aborted flag before rollback slave requests

There is a special case that the MDRequest needs to be preserved after
rolling back slave rename. The preserved MDRequest will be used later.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: fix-up inode's fragstat/rstat according its dirfrags

Extend the code that fixup inode's fragstat/rstat to handle multiple
dirfrags

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: encode dirfrag base in cache rejoin ack

Makes sure recovering MDS get uptodate fragstat/rstat for subtree root
dirfrags. it's required the codes that fix-up inode's fragstat/rstat.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: ignore stale rstat/fragstat when splitting dirfrag

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: fix root and mdsdir inodes' rsubdirs

inode rstat accounts inode itself.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: fix _rollback_repair_dir()

_rollback_repair_dir() may increase dirfrag's rfiles/rsubdirs twice.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: cancel fragmenting dirfrags when cluster is degraded

when cluster is degraded, acquiring locking can take long time.
It is not good to keep dirfrags in frozen state for a long time.

To allow cancelling fragment operation at any time, this commit
also reorganizes the codes that freeze/fetch dirfrags.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: allow negetive rstat

When splitting dirfrag, delta rstat is always added to the first new
dirfrag. Ancestors of the dirfrag may have nagtive rstat before the
delta rstat has been propagated to them. For example:

inode 100 n(v1 b-4096)
|- dir 100 n(v1 b-4096)
   |- dentry
      |- inode 101 n(v1 b-4096)
         |- dir 101.0* n(v1)/n(v1 b-4096)
         |- dir 101.1* n(v1)

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: handle export freezen race

handle following sequence of events:
- subtree becomes frozen, C_MDC_ExportFreeze is queued.
- export is cancelled
- C_MDC_ExportFreeze is executed.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
rgw: fix stripe_size calculation

Fixes: #8299
Backport: firefly
The stripe size calculation was broken, specifically affected cases
where we had manifest that described multiple parts.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>