The following operations sequence eventually fails with EBADF (let fstripe be a striped file, fnostripeX unstriped files):
1) swap_layouts fstripe fnostripe1
2) I/O into fstripe
3) swap_layouts fstripe fnostripe2
4) I/O into fstripe # Fails with EBADF
Please find a reproducer attached. This seems to affect current master as well as older versions of that provide layout swap.
The file remains unavailable, also after a client umount/remount or from another client.
It seems that lov_conf_set() doesn't call lov_layout_change() in the second case, leading to lov_io_init_empty() being called eventually on the write...