Whamcloud - gitweb
LU-13048 mdd: allow release after a non-blocking migrate 36/49236/33
authorCourrier Guillaume <guillaume.courrier@cea.fr>
Thu, 17 Nov 2022 12:15:19 +0000 (13:15 +0100)
committerOleg Drokin <green@whamcloud.com>
Mon, 4 Mar 2024 19:57:15 +0000 (19:57 +0000)
commit94d02e5774cc0d9ca5c3c34d21c2698ab89f3a6d
treedf9e81f039025a9cb8b2db808218ff795955b749
parent8f64231185a974c561c0603003d1e3f1749a390b
LU-13048 mdd: allow release after a non-blocking migrate

lfs setstripe -i0 file
lfs hsm_archive file
lfs migrate -n -i1 file
lfs hsm_release file

These actions lead to "Cannot send HSM request ...: Operation not
permitted". This happens because of data version mismatch. This error
is returned by mdt_hsm_release() when the data versions are not the
same.

This patch only corrects the non-blocking migrations.

mdd_swap_layouts is updated to check and update the HSM archive
version when possible. The new and old data versions are added as
arguments to this function. If the old data version does not match
the data version in the HSM attribute, we don't update the HSM
attribute because we don't know what caused the inconsistency.

During a swap between a volatile and a regular file, if both objects
have an HSM xattr, mdd_swap_layouts was called from the MDT HSM layer
(release and restore). In this case, we want to swap the HSM xattr
(previously done using SWAP_LAYOUTS_MDS_HSM as a last argument to
mdd_swap_layouts).

If only the regular file has an HSM attribute, mdd_swap_layouts was
called after a migration (blocking or not). In this case, we want to
update the HSM archive version only if the file is not dirty and if
the new data version is provided.

Also, this patch removes the CL_LAYOUT event that was emitted for a
release. Since a CL_HSM event with HE_RELEASE flag is also emitted,
the CL_LAYOUT is unecessary.

For "lfs swap_layouts", the operation is denied on 2 files with HSM
xattr (HSM xattr swap will cause inconsistencies).
With non-HSM file and archived file, the operation is allowed but the
dirty flag is set on the HSM file.

Add lustre_swab_close_data_special() to swab close_data fields inside
the union (specific to some types of close).

Add regression test sanity-hsm 607a, 607b and 607c.

Test-Parameters: clientversion=2.15.4 testlist=sanity-hsm
Test-Parameters: serverversion=2.15.4 testlist=sanity-hsm env=EXCEPT="114 409a"
Test-Parameters: testlist=sanity-hsm env=ONLY=607,ONLY_REPEAT=15
Signed-off-by: Courrier Guillaume <guillaume.courrier@cea.fr>
Signed-off-by: Etienne AUJAMES <eaujames@ddn.com>
Change-Id: I6e90131235f96255b636eea366ad0cef5f4f0b19
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49236
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
15 files changed:
lustre/include/lustre_swab.h
lustre/include/md_object.h
lustre/include/obd.h
lustre/include/uapi/linux/lustre/lustre_idl.h
lustre/include/uapi/linux/lustre/lustre_user.h
lustre/llite/file.c
lustre/mdc/mdc_lib.c
lustre/mdd/mdd_object.c
lustre/mdt/mdt_coordinator.c
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_lib.c
lustre/mdt/mdt_open.c
lustre/ptlrpc/pack_generic.c
lustre/tests/sanity-hsm.sh
lustre/utils/lfs.c