In vfs_open2-> vfs_open2_by_handle for some cases like UNCHECKED create we want to set attrs_out->valid_mask to ATTR_RDATTR_ERR, so that caller should not rely on populated attrs_out and do getattrs to get valid attrs.

        } else if (attrs_out && attrs_out->request_mask & ATTR_RDATTR_ERR) {

                attrs_out->valid_mask &= ATTR_RDATTR_ERR;

        }


Doing "&=" is not setting ATTR_RDATTR_ERR as valid_mask is set to 0 by caller. So caller will always rely on attrs_out.
We should do "=" here.

        } else if (attrs_out && attrs_out->request_mask & ATTR_RDATTR_ERR) {

                attrs_out->valid_mask = ATTR_RDATTR_ERR;

        }


This could happen if there is create with createmode < FSAL_EXCLUSIVE and file is already created with mdcache populated handle. We could end corrupting mdcache attrs in such case.


Regards,
Gaurav